I have in my documents a state with value "OK".
The following match query returns me this document:
POST /bank/_search
{
"query": {
"bool" : {
"must" : {
"match" : { "state" : "OK" }
}
}}}
The following term query does not return me the document with state "OK":
POST /bank/_search
{
"query": {
"bool" : {
"must" : {
"term" : { "state" : "OK" }
}
}}}
As per definition "The term query finds documents that contain the exact term specified in the inverted index." Still i am confused why term query does not return the desired document.
I imported the data through sense by executing following command:
curl -XPOST 'localhost:9200/bank/account/_bulk?pretty' --data-binary "@accounts.json"
curl 'localhost:9200/_cat/indices?v'
It would be great if someone can also share some info about inverted/non-inverted, analyzed/non-analyzed and term/match. I read about these but i am still confused.