Using elasticsearch and watcher, I'm having the same issue as here:
However, using the proposed solution is not working, groovy.json.JSONOutput is not supported anymore. I opened an issue in the elastic repo.
There you can read deeply about the situation. Summarizing, watcher ctx.payload.hits is giving me a java.util.HashMap object and I need a json object.
Any other possible way to retrieve a json instead of a java.util.HashMap response from watcher ctx? Or do I have to program using groovy core a parser from HashMap to json?
I'm using
Elasticsearch version: 2.3
JVM version: openjdk version "1.8.0_91"
OpenJDK Runtime Environment (build 1.8.0_91-b14)
OpenJDK 64-Bit Server VM (build 25.91-b14, mixed mode)
indeed I dont see a clean way that this is possible at the moment, without tedious manual construction inside of a string. Maybe a mustache function like {{#toJson}} (that accepts map as an argument) could help a lot here - but I am not sure if this is how mustache works, as I would expect it to only be able to handle strings - need to check it out.
Thanks for the response. I manage using some regex in ruby to parse it down. It would be nice to contribute to the community, but not sure how to proceed.
Taking a look at the elasticsearch mustache integration and the possibility to add a JSON function might make sense here. This could be reused in watcher then.
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.