-
-
Save dadoonet/4523584 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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