Skip to content

Instantly share code, notes, and snippets.

@diloabininyeri
Last active November 19, 2018 11:55
Show Gist options
  • Save diloabininyeri/af34d3220483219a00ab0857eee4d5a9 to your computer and use it in GitHub Desktop.
Save diloabininyeri/af34d3220483219a00ab0857eee4d5a9 to your computer and use it in GitHub Desktop.
POST http://localhost:9200/accounts/person/_search
Content-Type: application/json
{
"suggest": {
"mysuggest-example": {
"text": "jon",
"term": {
"field": "name",
"suggest_mode": "always",
"min_word_length": 1,
"string_distance": "levenstein"
}
}
}
}
###
response
{
"took": 2,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 0,
"max_score": 0.0,
"hits": []
},
"suggest": {
"mysuggest-example": [
{
"text": "jon",
"offset": 0,
"length": 3,
"options": [
{
"text": "john",
"score": 0.75,
"freq": 1
},
{
"text": "joni",
"score": 0.75,
"freq": 1
},
{
"text": "johbn",
"score": 0.6,
"freq": 1
}
]
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment