I'm trying to implement search with Elastic Search but having some prob:
What I Have
I'm trying to implementing ElasticSearch I've 2 fields which are :
1) Search term (TextField)
2) City Name (Text Field)
Now what I want here is if user enter both the value then it must search with both (AND Condition) else if user enter search term then it search only search term OR if city then search only City.
What I'm doing
"bool" : {
"should": [
{
"multi_match": {
"query": '"'+keyword.toLowerCase()+'"',
"fields":
[
"title", "desc"
]
}
},
{
"match":
{
"city": city.toLowerCase()
}
}
],
}
but it's not working it's searching with OR.
Any help much appreciated.
Thanks in Advance
Randheer