For input sentence:
quick brown fox
I need to get matching for quick brown (phrase match) but also to uic (regex match). How can this be achieved?
You can use a boolean query to combine match phrase and regexp query.
Adding a working example with index data, search query and search result
Index Data:
{
"title":"quick brown fox"
}
Search Query:
{
"query": {
"bool": {
"should": [
{
"match_phrase": {
"title": "quick brown"
}
},
{
"regexp": {
"title": {
"value": ".*uic.*"
}
}
}
]
}
}
}
Search Result:
"hits": [
{
"_index": "65777213",
"_type": "_doc",
"_id": "1",
"_score": 1.5753641,
"_source": {
"title": "quick brown fox"
}
}
]