build
mvn clean package -DskipTests
run
cd ./target/bin export ES_CLASSPATH="../classes:../lib/*"; ./elasticsearch
create index
curl -XPUT http://localhost:9200/test_local_index/ -d ' {}'
mapping
curl -XPUT http://localhost:9200/test_local_index/test/_mapping -d ' { "test" : { "properties" : { "pin" : { "properties" : { "location" : { "type" : "geo_point" } } } } } }'
add document
curl -XPOST http://localhost:9200/test_local_index/test/2 -d '{ "pin" : { "location" : { "lat" : 40.12, "lon" : -71.34 },
"tag" : ["food", "family"], "text" : "my favorite family restaurant" }
}'
search
curl -XPOST http://localhost:9200/test_local_index/_search -d ' { "query" : { "filtered" : { "query" : { "match" : { "text" : "restaurant" } }, "filter" : { "geo_distance" : { "distance" : "150km", "pin.location" : { "lat" : 40, "lon" : -70
} } } } } }'