I've set an elastic index. I have 100,000 documents all with the following fields
{
"Make:": "NISSAN",
"Model:": "FUGA",
"Body Type:": "SEDAN",
"Year of Manufacture:": 2012,
"Country:": "JAPAN",
"Fuel Type:": "PETROL",
}
I need to create a search based on four possible terms
- Make
- Model
- Year of Manufacture
- Fuel Type
Below are four possible combinations for a search query
2012 nissan fuga petrol
nissan fuga 2012 petrol
petrol 2012 nissan fuga
nissan fuga petrol 2012
Assuming we have correct spelling on the search query, below is how i tried searching based on the search query
curl -X GET "localhost:9200/vehicles/_search?pretty" -H 'Content-Type: application/json' -d'
{
"query": {
"simple_query_string" : {
"query": "2012 NISSAN FUGA PETROL",
"fields": ["Make","Model","Year of Manufacture","Fuel Type"]
}
}
}
Out of surprise, the search didn't return any hits
{
"took" : 0,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 0,
"relation" : "eq"
},
"max_score" : null,
"hits" : [ ]
}
}
Below is more information on my version of elastic
{
"name": "salim-HP-EliteBook-840-G5",
"cluster_name": "elasticsearch",
"cluster_uuid": "mSWKP4G1TSSq9rI3Hc0f6w",
"version": {
"number": "7.5.1",
"build_flavor": "default",
"build_type": "tar",
"build_hash": "3ae9ac9a93c95bd0cdc054951cf95d88e1e18d96",
"build_date": "2019-12-16T22:57:37.835892Z",
"build_snapshot": false,
"lucene_version": "8.3.0",
"minimum_wire_compatibility_version": "6.8.0",
"minimum_index_compatibility_version": "6.0.0-beta1"
},
"tagline": "You Know, for Search"
}
How can i make a successful search based on my search criteria ?