I have some problems with NOT operator in Elastic search, Here is my query
{
"query": {
"filtered": {
"query": {
"query_string": {
"query": "-et_tax:\"Agriculture\" -et_tax:\"Airports/Ports\""
}
}
}
},
"aggs": {
"lawfirmcount": {
"cardinality": {
"field": "pd_lawfirmID",
"precision_threshold": 1250
}
}
}
}
I am framing the query using PHP & MySQL. When i use the above it was showing wrong results, I need to exclude these results in my total results, I am expecting result is showing all the records but not in et_tax Column as Agriculture AND Airport/Ports. So how can i use the multiple NOT operator in my query.
UPDATE :
When i Pass the same query AND/OR both will show same results,
{
"query": {
"filtered": {
"query": {
"query_string": {
"query": "-et_tax:\"Agriculture\" AND -et_tax:\"Airports/Ports\""
}
}
}
},
"aggs": {
"lawfirmcount": {
"cardinality": {
"field": "pd_lawfirmID",
"precision_threshold": 1250
}
}
}
}
The above with AND operator it will show 1564 records, and below query with OR operator it also shows the same count.
{
"query": {
"filtered": {
"query": {
"query_string": {
"query": "-et_tax:\"Agriculture\" OR -et_tax:\"Airports/Ports\""
}
}
}
},
"aggs": {
"lawfirmcount": {
"cardinality": {
"field": "pd_lawfirmID",
"precision_threshold": 1250
}
}
}
}
Thanks in Advance,