I am beginning to write some server side scripts, and was running into a few issues. I think it stems from my fundamental understanding of the data structures and objects that are handled in the script.
The goal of the script is given a set of values check a field in the document (which should have multiples values or an array) and return true if the values of the field is composed only of the given set of values.
i.e.:
given: ['A', 'B'] and comparing against "myField"
This script has been returning documents with any values for 'myfield' and seems to not honor the second clause of the boolean expression am curious what I may be missing here.
Thank you for taking the time and offering your help, as it tremendously helps further my learning in the Elasticsearch ecosystem!
Thanks for the link,
it seems the problem in there is slightly different, but the same logic can be translated. Since the field that is being queried does not live in a nested object, do you know what changes would be necessary to apply the same effect?
Also I should make a correction to my last comment, the field lives in a nested object, but the array that is being queried is not a collection of complex objects.
Thanks for testing that out, let me post the real-world scenario, as there may be some shortcoming introduced when moving from the simple case to the troublesome particular case.
Hi @cj_hillbrand,
I'm still getting the correct result.
I find it useful to reproduce the issue in the dev console, could you post a reproduction that's easy to copy and paste into the dev console rather than snippets?
I suspect creating getting the minimal dev console reproduction will get you far along toward solving the issue.
Thanks for your patience, and recommendation on posting something to copy + paste into dev console rather than snippets. Ill be sure to carry that with me in future posts.
I went ahead and tried the example that you had outlined, and things worked as expected. I even tried the old example that I had originally posted and it works as well.
Stu, to be frank, I think I had a line in between the GET my_index/_search and the json query.
Ill go ahead and mark your response as an answer, effectively closing this thread.
Thank you again for the time, recommendations and patience!
CJ
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.