We are on the AWS implementation on ES5. This has limitations which I am now trying to work around.
The limitation I'd like help on relates to dynamic scripting - AWS appears to be only allowing Painless. This means that mustache is not available.
(see announcement: https://aws.amazon.com/about-aws/whats-new/2017/01/elasticsearch-5-now-available-on-amazon-elasticsearch-service/)
I need help because we are using an "on_failure" in our ingest pipelines. Essentially we are using a) filebeat to send logs to b) an ingest pipeline that c) uses GROK to parse it.
We assume that our GROK syntax will not always be perfect and so, when a mistake happens, we want "on_failure" to send the errant message to a new Index called Failed-IndexName.
Elasic's excellent documentation shows how to do this:
Source: https://www.elastic.co/guide/en/elasticsearch/reference/current/handling-failure-in-pipelines.html
"on_failure" : [
{
"set" : {
"field" : "_index",
"value" : "failed-{{ _index }}"
}
}
]
This is fantasic. Unfortunately the {{ }} in "failed-{{ _index }}" is mustache, at least according to the error when I try to upload my pipeline.
"script_lang not supported [mustache]"},"header":{"processor_type":"set"}}
So I am trying Painless, which AWS says they do support for Dynamic Scripting. From my ingest pipeline:
"on_failure":[
{
"set":{
"field":"_index",
"value":{
"script":{
"type":"string",
"script":{
"lang":"painless",
"inline":"failed-doc['_index'].value"
}
}
}
}
}
]
The error for on_failure events is:
Can not index event (status=400): {"type":"illegal_argument_exception","reason":"field [_index] of type [java.util.HashMap] cannot be cast to [java.lang.String]"}
I don't understand the error above any guidance would be appreciated.
Thanks!