Skip to content

Instantly share code, notes, and snippets.

@mfsiat
Created April 24, 2021 10:42
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 mfsiat/5992c07054547a9b75babd003bb46b33 to your computer and use it in GitHub Desktop.
Save mfsiat/5992c07054547a9b75babd003bb46b33 to your computer and use it in GitHub Desktop.
Prefix query in Elasticsearch
{
"query": {
"bool": {
"must": [
{
"prefix": {"business_name_filtered": "johukum"}
}
]
}
} ,
"suggest": {
"namesuggester": {
"text": "johukum",
"term": {
"field": "business_name"
}
}
},
"from": 0,
"size": 5,
"sort": [
{
"_geo_distance": {
"geo": {
"lat": 23.761546526247017,
"lon": 90.43369546206912
},
"order": "asc",
"unit": "km"
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment