I have problems with combining terms, must_not requests for attached documents.
An example of meaning can be found here: http://sense.qbox.io/gist/be436a1ffa01e4630a964f48b2d5b3a1ef5fa176
Here is my mapping:
{ "mappings": { "docs" : { "properties": { "tags" : { "type": "nested", "properties" : { "type": { "type": "string", "index": "not_analyzed" } } }, "label" : { "type": "string" } } } } }
with two documents in this index:
{ "tags" : [ {"type" : "POST"}, {"type" : "DELETE"} ], "label" : "item 1" }, { "tags" : [ {"type" : "POST"} ], "label" : "item 2" }
When I query this index as follows:
{ "query": { "nested": { "path": "tags", "query": { "bool": { "must": { "term": { "tags.type": "DELETE" } } } } } } }
I have one hit (which is correct)
When I want to receive documents that DO NOT CONTAIN the "DELETE" tag with this request:
{ "query": { "nested": { "path": "tags", "query": { "bool": { "must_not": { "term": { "tags.type": "delete" } } } } } } }
I have 2 hits (which is wrong). This question seems very close to this (the Elasticsearch array should and must_not ), but it is not ...
Can you give me some tips to solve this problem?
thanks
source share