Why doesn"t must_not take effect?
mapping:
"text_terms": {
"type": "nested",
"properties": {
"term": {
"type": "string",
"index": "not_analyzed"
},
"freq": {
"type": "integer"
}
}
}
data
{ "text_terms" : [ { "term" : "aaa", "freq" : 1 }, { "term" : "bbb", "freq" : 1 }, { "term" : "ccc", "freq" : 1 } ] }
{ "text_terms" : [ { "term" : "aaa", "freq" : 1 }, { "term" : "", "freq" : 1 }, { "term" : "ccc", "freq" : 1 } ] }
{ "text_terms" : [ { "term" : "ccc", "freq" : 1 }, { "term" : "", "freq" : 1 }, { "term" : "ddd", "freq" : 1 } ] }
{ "text_terms" : [ { "term" : "ddd", "freq" : 1 }, { "term" : "eee", "freq" : 1 } ] }
query records containing Siemens
have no problem finding two records containing Siemens
"query": { "nested": { "query": { "bool": { "must": [{ "term": { "text_terms.term": "" } }] } }, "path": "text_terms" } }
but does the query not take effect when it does not contain Siemens records?
"query": { "nested": { "query": { "bool": { "must_not": [{ "term": { "text_terms.term": "" } }] } }, "path": "text_terms" } }
how can all four records be found at this time?