Im pretty new to watcher and painless. I'm getting this error and I have no clue why. Can you guys help me out for this one?
What i need to do is retrieve the value of "SAM Account Name: " in the ES item called "message" ( see screenshot below). So after trial and error scripting i came up with that script. It looks good but a little something seems to be missing. I'm getting this error: StringIndexOutOfBoundsException[String index out of range: -1] as soon as I execute the watch.
Please use something like gist or pastebin or paste the full watch.
Also, please try to run the search query first in isolation to see if matches your expections. In this example you seem to run OR combined queries in the query_string query which could explain that many results.
When pasting the execute watch API response others can see the search response, making it easier to see why your script failed.
your field is named Message while you referred to it in the script you provided as message. Field names are case sensitive.
The out of bounds exception could result from a couple of calls, as you dont do any checking on length or content before using substring, lastIndexOf, which are the most likely candidates.
The transform does not properly bubble show our awesome painless exceptions. If you put the script for testing into the condition, you should be able to see a more proper stack trace, where exactly the script failed.
We're running 5.3. in prod. We're migrating to 6.1.1 tonight That being said if you look at the pastebin again there is 2 fields named "message". 1 is lower case and the other one is Upper case. The information i'm looking for is in the lower case one
hope everything went well. The reason for my ask is, that starting from ES 6.1 we will have proper exceptions with scripting issues, so that it should be super simple to find the offending code snippet, when you call the execute watch API.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.