In the ES doc under Terms Aggregations, it gives the following on using a script to generate terms for Aggregations:
Generating the terms using a script:
GET /_search
{
"aggs" : {
"genres" : {
"terms" : {
"script" : {
"source": "doc['genre'].value",
"lang": "painless"
}
}
}
}
}
This is not working for me. In the Kibana Console, I see the results:
{
"error": {
"root_cause": [
{
"type": "parsing_exception",
"reason": "[terms] failed to parse field [script]",
"line": 6,
"col": 21
}
],
"type": "parsing_exception",
"reason": "[terms] failed to parse field [script]",
"line": 6,
"col": 21,
"caused_by": {
"type": "illegal_argument_exception",
"reason": "[script] unknown field [source], parser not found"
}
},
"status": 400
}
Of course I also adapted this query to my own specific index, type, and fields, with the same result.
I really do need this to work because I have 2 fields that need to be combined to generate the buckets I need.
I am using ES 5.3, since that is in production, but we could change if this is something fixed in a later version.
Some help would be most appreciated. Hopefully it is just a small issue or mistake on my part. I have worked with scripts in aggregations in the same production environment without problems, but haven't before tried to do this specifically.
Thank you!
Patrick