Hi,
Can any one provide me the query which will fetch the document on basis of input provided.
For ex . If I pass a person's name it should search document by name and when I pass a phone number it should search document by phone
Note Input is passed through a search box, so the term is stored in a variable which is passed input to match{}
You are looking for a multi field query:
Example:
GET /_search
{
"query": {
"multi_match": {
"query": "John",
"fields": [
"name",
"phone.keyword"
]
}
}
}
1 Like
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.