the first filters on must[condition A] (and the one doc is returned)
-the second filters on must[condition B] (the same doc is returned)
-the third filters on condition must[ A,B] (no hits)
I have no trouble making this work with non-nested properties, but with the nested
properties in my example I get this unexpected result.
Frank
That works for color, but I would like to add a second set of must's to your example with
key='Type' and value='Autoclavable'. (Since there could be blue things with a type of 'somethingElse' and I need to select only blue, autoclavable types )
since the document contains:
nested attributes:[
{u'key': u'Color', u'value': [u'Black', u'Blue', u'Teal']},
{u'key': u'Type', u'value': [u'Autoclavable']}
]
-would that not also eval to true? It doesn't, and I am not sure why not.
Could it be that only one "key/value" element is examined in a pass - so that if I add to your example a term clause
of "term": { "attributes.key": "Type" } it becomes false because key is already "Color" and can't also be "Type"?
Maybe I need a different index structure to do something like
"select a doc from elasticsearch having an attribute where
( key = color and value= 'Blue')
and also having an attribute where
(key = Type and value= 'Autoclavable'
I am ultimately trying to have dynamic filterable attributes.
I believe the issue is when using nested documents there is no nested document which has key = color, value= 'Blue, key = Type and value= 'Autoclavable'. What you have is two nested documents one with ( key = color and value= 'Blue') and a second with (key = Type and value= 'Autoclavable'). So this is why the search fails. See this example:
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.