I have two different behaviours with two queries that are exactly the same.
In my first query the must_not clause is not filtering brand3 and brand4 is returning brand3 and brand4 products. However the second query the must_not is working. (ES version 1.5.2)
First query:
GET firstindex/product/_search
{
"filter":{
"bool": {
"should": [
{"bool": {
"must_not":{ "terms": {"brand.raw": ["brand3,brand4"]}
},
"must":{
"term" : {"retailer" : "retailer1"}
}
}
}
]
}
}
,
"size":10000
}
Second query:
GET secondindex/product/_search
{
"filter":{
"bool": {
"should": [
{"bool": {
"must_not": { "terms": {"brand.raw": ["brand1,brand2"]}
},
"must":{
"term" : {"retailer" : "retailer2"}
}
}
}
]
}
}
,
"size":10000
}
The mapping for brand is:
"brand":{
"type":"string",
"fields":{
"raw":{
"type":"string",
"index":"not_analyzed"
}
}
}
I got stuck, what I can do to know what is happening? I tried to clear the cache but it's still not working.
Thanks