Skip to content

Instantly share code, notes, and snippets.

@ThorstenS
Created April 22, 2014 20:29
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 ThorstenS/11193188 to your computer and use it in GitHub Desktop.
Save ThorstenS/11193188 to your computer and use it in GitHub Desktop.
Elasticsearch fuzzy query
curl -XDELETE 'http://localhost:9200/twitter/'
curl -XPUT 'http://localhost:9200/twitter/'
curl -XPUT 'http://localhost:9200/twitter/tweet/1' -d '
{
"user": "kimchy",
"postDate": "2009-11-15T13:12:00",
"message": "Trying out Elastic Search, so far so good?",
"location" : {
"lat" : 41.12,
"lon" : 8.21
}
}'
curl -XPUT 'http://localhost:9200/twitter/tweet/2' -d '
{
"user": "kimchy",
"postDate": "2009-11-15T14:12:12",
"message": "Another tweet, will it be indexed?" ,
"location" : {
"lat" : 50.12,
"lon" : 8.34
}
}'
curl http://localhost:9200/twitter/tweet/_search/?pretty=true -d '{
"query": {
"fuzzy": {
"user": {
"value": "mimchy",
"fuzziness": 2
}
}
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment