I have just implemented ELASTIC SEARCH on my database and I am very new to this. I have to write query that has to-
Search database field "name" with the search text entered by user.
User can also apply filters on search text like country array or colour array or any tags array
It must check if any filter is applied then only it should match it with respective fields in database.
query in mongo be like:
aggregate.match({ '$text': { '$search': searchString } });
if(portarray){
aggregate.match({ 'Port' : { $in:portArray } });
}
if(countriesArray){
aggregate.match({ 'country' : { $in: countriesArray } });
}
Please help me with this.
I'd suggest you read in the official Elasticsearch tutorial, for example: this artice
Fo example, answering your first question, you should query:
GET /yourIndexName/_search
{
"query":
{ "match":
{ "Name": "Pablo Escobar" }
}
}