how to use multiple match phrases in must with or condition in elastic search?
GET questiondetails/question/_search
{
"query": {
"bool": {
"should": [
{
"match_phrase": {
"tags.keyword": "azure-data"
}
},
{
"match_phrase": {
"body": "azure-data"
}
},
{
"match_phrase": {
"title": "azure-data"
}
},
{
"match_phrase": {
"answers.body": "azure-data"
}
}
],
"minimum_should_match": 1,
"filter": {
"range": {
"creation_date": {
"gte": 1584748800,
"lte": 1585612800
}
}
}
}
},
"size": "10000"
}
tried this query .... I need results in where the word exactly matches in tags or partial match on body or title or answer.body
But its not working .
Adding comment
GET questiondetails_new/question/_search? { "query": { "bool": { "should": [{ "match_phrase": { "tags.keyword": "azure-data-factory" } }, { "match_phrase": { "title": "azure-data-factory" } } ], "minimum_should_match": 1, "filter": { "range": { "creation_date": { "gte": 1585170170, "lte": 1585170180 } } }
In this query i need all the docs which has exact match as azure-data-factory or which has azure-data-factory in its titile (String ). It should be an or search . But its matching with the tags which has the value as azure-data-factory-2 also