Reputation: 45
I need to make a match for an exact sentance. Here is the query Im using
{
"query": {
"match": {
"description": "void names error"
}
}
}
But the above query is returning me not only the exact matching documents but also many other partial matches too. How to make an exact match of the above sentance?
Upvotes: 3
Views: 2112
Reputation: 19253
Phrase query would be the best candidate here. Phrase will make sure that those tokens which are next to each other only matches.
If you want to match based on the order and want to score based on how well close they are , I would suggest span near query series.
Upvotes: 3
Reputation: 6218
{
"query": {
"match": {
"description": "void names error",
"type":"phrase"
}
}
}
More Details at Phrase Query
Upvotes: 4