elasticsearch - Why am I not able to query by geolocation in elastic search? -
So I'm experimenting with elastic search and that's what I did.
1) A geo-map mapping was added to my index named "test"
curl -XPOST localhost: 9200 / test -d '{"mappings": {"Type1": {"_source": {"enabled"}: "properties": {"location": {"type": "geo_point", "index": "not_analyzed"}}}}} '
2) A document was indexed under the test:
curl -XPUT 'localhost: 9200 / test / type1 / 1? Beautiful '-D' {"Location": {"3) Then a question was written by geographical location filter like this: curl -XPOST '' host: 9200 / test2 / _search Beautiful '-d' {"filtered": {"query": {"match_all": {}}, "filter": {"geo_distance": {" I get this for: "200 kilometers", "space": {"lat": 40, "Lo N": -70}}}}} / P>
"error": "Failed to execute the searchfacesexception exception [the query], all shards fail; ShardFailures {[QpGEHtdcReeYmt8X2tG26g] [test2] [0]: RemoteTransportException [[Jester] [Cabinet [/10.58.91.21:9301]] [search / step / query]]; Nested: Searchpace exception [[test2] [0]: to [-1], size [-1]: pars failure [failed to parse the source [ no ]]]; Nested: ElasticsearchParseException [failed to get xcontent from org.elasticsearch.common.bytes.ChannelBufferBytesReference@60d8bc76]; After the text "itemprop =" text ">
Firstly, in your query (third part of the code), localhost : 9 0000 / test2 / _ search? Beautiful
should be localhost: 9200 / test / _ search? Beautiful
, that is, you are not asking the correct indicator.
Then your query should just be query
keyword (i.e. filtered
) and is attached to query
), it Should look like this:
curl -XPOST 'localhost: 9200 / test / _search? Pretty '-d' {{query}: {"match_all": {}}, "filter": {"geo_distance": {"distance": "200 km", "location": {" Lat ": 40," loan ": -70}}}}}}
Comments
Post a Comment