In elastic search this filter
{ "bool": { "must": { "term": { "article.title": "google" } } } }
Correctly returns articles with "google" in the title.
However
{ "bool": { "must": { "term": { "article.title": "google earth" } } } }
It does not return any results, despite the fact that the title contains articles with the exact words "google earth". I would like it to do.
Full request:
{ "size": 200, "filter": { "bool": { "must": { "term": { "article.title": "google maps" } } } }, { "range": { "created_date": { "from": "2013-01-11T02:14:03.352Z" } } }] } }
As you can see, I donβt have a βrequestβ - just a filter, size and range. Therefore, I believe that ElasticSearch uses the default analyzer ...?
What? I do not understand?
EDIT: For those looking for a solution, here is my filter:
{ "query": { "bool": { "must": { "must_match": { "article.title": "google earth" } } } } }
Node, that (1) we wrapped the bool filter with a "query" and (2) the "term" was changed to "must_match", which leads to the agreement of the whole phrase (as opposed to the "match" that will be searched in the .title article with a standard analyzer on Google Earth).
The full query looks like this:
{ "size": 200, "filter": { "query": { "bool": { "must": { "must_match": { "article.title": "google earth" } } } } } }
FWIW, the reason I have this condition in the filter field (as opposed to using a standard query) is because sometimes I want to use must_not instead of must_not, and sometimes I also add other query elements .