Skip to content

Instantly share code, notes, and snippets.

@dadoonet
Forked from kimchey/geopoly_percolator
Last active December 11, 2015 01:28
Show Gist options
  • Save dadoonet/4523584 to your computer and use it in GitHub Desktop.
Save dadoonet/4523584 to your computer and use it in GitHub Desktop.
curl -XDELETE localhost:9200/listing
curl -XPUT localhost:9200/listing
curl -XPUT localhost:9200/listing/listing/_mapping -d '
{"listing":{"properties":{"address":{"type":"string"},
"id":{"type":"string"},
"location":{"type":"geo_point"}
}}}'
curl -X PUT localhost:9200/_percolator/listing/q1str2?pretty -d '
{"query":
{"filtered":
{"query": {"match_all": {}},
"filter":
{"and":
[{"and":
[
{"geo_polygon": {
"location": {
"points": [
{"lat" : 40, "lon" : -70},
{"lat" : 30, "lon" : -80},
{"lat" : 20, "lon" : -90}
]
}
}
}
]}]}}}
}'
curl -XPUT localhost:9200/listing/listing/1 -d '
{
"location" : {
"lat" : 40.12,
"lon" : -71.34
}
}'
curl -XPOST localhost:9200/listing/_search?pretty -d '
{"query":
{"filtered":
{"query": {"match_all": {}},
"filter":
{"and":
[{"and":
[
{"geo_polygon": {
"location": {
"points": [
{"lat" : 40, "lon" : -70},
{"lat" : 30, "lon" : -80},
{"lat" : 20, "lon" : -90}
]
}
}
}
]}]}}}
}'
curl -XGET localhost:9200/listing/listing/_percolate -d '
{
"doc": {
"location" : {
"lat" : 40.12,
"lon" : -71.34
}
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment