Reputation: 323
I have a simple multi_match query like this:
{
"from": 0,
"size": 10,
"query": {
"multi_match": {
"query": "RNA sequencing"
}
}
}
This works well as intended, however I'd like to make my query a match phrase query so it returns "RNA sequencing" as a phrase and not "RNA" and "sequencing" separately. I tried doing this
{
"from": 0,
"size": 10,
"query": {
"multi_match": {
"query": "RNA sequencing", "type": "phrase"
}
}
}
And
{
"from": 0,
"size": 10,
"query": {
"multi_match": {
"match_phrase": {"query": "RNA sequencing"}
}
}
}
but they both result parsing errors. Any ideas on what to do?
Upvotes: 0
Views: 84
Reputation: 16172
Adding a working example with index data, search query, and search result
Index Data:
{
"title":"sequencing"
}
{
"title":"RNA sequencing"
}
{
"title":"RNA"
}
Search Query:
{
"query": {
"multi_match": {
"query": "RNA sequencing",
"type": "phrase"
}
}
}
Search Result:
"hits": [
{
"_index": "65314008",
"_type": "_doc",
"_id": "1",
"_score": 0.9808291,
"_source": {
"title": "RNA sequencing"
}
}
]
Upvotes: 1