Created
August 24, 2011 20:49
-
-
Save kimchy/1169185 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 -XPUT localhost:9200/_template/test -d '{ | |
| "template" : "test*", | |
| "order" : 0, | |
| "settings" : { | |
| "number_of_shards": 2, | |
| "number_of_replicas": 0 | |
| }, | |
| "mappings" : { | |
| "test" : { | |
| "properties" : { | |
| "test_id": { "type": "string", "index" : "not_analyzed" }, | |
| "message": { "type": "string" }, | |
| "data": { "type": "string" }, | |
| "pos": { | |
| "type": "nested", | |
| "properties": { | |
| "time": { "type": "integer" }, | |
| "point": { "type": "geo_point" } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }' | |
| curl -XPUT localhost:9200/test_index | |
| curl -XPUT localhost:9200/test_index/test/QGwh9bSuEeCkF5LPzrOdVw -d '{ | |
| "test_id": "QGwh9bSuEeCkF5LPzrOdVw", | |
| "message": "Test message One", | |
| "data": "ABC One Two Three", | |
| "pos": [ | |
| { "time": 1313111081, "point": {"lat": 47.6142365, "lon": -122.3518001 } }, | |
| { "time": 1313111071, "point": {"lat": 47.6142370, "lon": -122.3518040 } } | |
| ] | |
| }' | |
| curl -XPUT localhost:9200/test_index/test/Okb2vLoMEeChFwAMKVTLCw -d '{ | |
| "test_id": "Okb2vLoMEeChFwAMKVTLCw", | |
| "message": "Test message Two", | |
| "data": "DEF Four Five Six", | |
| "pos": [ | |
| { "time": 1308441391, "point": {"lat": 47.7326653, "lon": -122.2580922 } }, | |
| { "time": 1308441491, "point": {"lat": 47.7326753, "lon": -122.2581022 } } | |
| ] | |
| }' | |
| curl localhost:9200/_all/test/_search -d '{ | |
| "query": { | |
| "constant_score": { | |
| "filter": { | |
| "nested": { | |
| "path": "pos", | |
| "query": { | |
| "constant_score": { | |
| "filter": { | |
| "geo_bounding_box": { | |
| "pos.point": { | |
| "bottom_right": { | |
| "lat": 47, | |
| "lon": -120 | |
| }, | |
| "top_left": { | |
| "lat": 48, | |
| "lon": -124 | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment