Skip to content

Instantly share code, notes, and snippets.

@shashankgutha
Created May 29, 2017 07:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shashankgutha/0b75774d273091590dd0765ee63276af to your computer and use it in GitHub Desktop.
Save shashankgutha/0b75774d273091590dd0765ee63276af to your computer and use it in GitHub Desktop.
Exact matches with match query on analyzed field not showing on top
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