Hi @ all,
I tried following:
Language: painless
Type: String
Using this fields in my index creates errors:
if (doc['PS_Status'].value == 'Failed') {
return "Failed";
} else if (doc['PS_Status'].value == 'OK') {
return "OK";
}
Following works fine:
if (doc['Gross_Value'].value > 1000) {
return "<1000 €"
} else if (doc['Gross_Value'].value > 1000) {
return ">1000 €"
}
What should I do to get results with string based queries?
Error:
blabla "caused_by":{"type":"illegal_argument_exception","reason":"Fielddata is disabled on text fields by default. Set fielddata=true on [PS_Status] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead."}}}]},"status":500}...
Yeah do it:
PUT date/_mapping/_doc
{
"properties": {
"PS_Status": {
"type": "text",
"fielddata": true
}
}
}
doh'
{
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "Rejecting mapping update to [date] as the final mapping would have more than 1 type: [_doc, doc]"
}
],
"type": "illegal_argument_exception",
"reason": "Rejecting mapping update to [date] as the final mapping would have more than 1 type: [_doc, doc]"
},
"status": 400
}
hmm, failed, lost etc...
No any example even the this Verwendung von Painless in geskripteten Kibana-Feldern | Elastic Blog tells me why I can't do this!
There's no mention of what to do anywhere when running in this trouble!
Thanks for help
Regards