I have stored some data in elasticsearch module and structure is very simple.
[
{
"country_id":1,
"city_id":12,
"city_name":"Kolkata"
},
{
"country_id":1,
"city_id":55,
"city_name":"Delhi"
},
{
"country_id":2,
"city_id":18,
"city_name":"Las Vegas"
},
{
"country_id":3,
"city_id":22,
"city_name":"Sydney"
}
]
I need a search query like
"Select * from table_name where country_id = 1 and city_name like %k%"
If any one there please help me to find out the exact elasticsearch query for the above sql query.
I have tried with this query but it is producing errors.
curl -XGET "http://xxx.xxx.xxx.x:9200/xxxx/location_details/_search?size=10" -d '{"query":{"bool":{"must":{"term":{"country_id":"101"}}},{"match_phrase":{"city_name":"a"}}}}'