Created
May 29, 2017 07:20
-
-
Save shashankgutha/0b75774d273091590dd0765ee63276af to your computer and use it in GitHub Desktop.
Exact matches with match query on analyzed field not showing on top
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DELETE demotest | |
POST /demotest/demotest/2 | |
{ | |
"name": "Duvvuri ram gopal reddy" | |
} | |
POST /demotest/demotest/1 | |
{ | |
"name": "ram gopal reddy" | |
} | |
POST /demotest/demotest/3 | |
{ | |
"name": "reddy ram gopal" | |
} | |
POST /demotest/demotest/9 | |
{ | |
"name": "Dulugunti Ram Gopal Reddy " | |
} | |
#search | |
GET demotest/_search | |
{ | |
"query": { | |
"bool": { | |
"should": [ | |
{ | |
"match_phrase": { | |
"name": { | |
"query" : "ram gopal reddy", | |
"boost": 8.0 | |
} | |
} | |
}, | |
{ | |
"match": { | |
"name": { | |
"query": "ram gopal reddy" | |
} | |
} | |
} | |
] | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment