I have a very simple mapping that looks like this (I simplified the example a bit):
{ "location" : { "properties": { "name": { "type": "string", "boost": 2.0, "analyzer": "snowball" }, "description": { "type": "string", "analyzer": "snowball" } } } }
Now I index many locations using some random values ββthat are based on real English words.
I would like to be able to search for locations that match any of the specified keywords in the name or in the description field (the name is more important, therefore, the promotion I gave). I tried several different queries and they do not return any results.
{ "fields" : ["name", "description"], "query" : { "terms" : { "name" : ["savage"], "description" : ["savage"] }, "from" : 0, "size" : 500 } }
Given that there are places in which the word "wild" in the description, it should get me some results (the savage is the core of the savage). It gives 0 results using the above query. I used curl to query ES:
curl -XGET -d @query.json http://localhost:9200/myindex/locations/_search
If I use the query string instead:
curl -XGET http://localhost:9200/fieldtripfinder/locations/_search?q=description:savage
In fact, I get one result (of course, now it will only look for the description field).
Basically, I am looking for a query that will perform an OR type search using several keywords and compare them with the values ββin both the name and description field.