Hi,
I have been trying to use a polygon query. Elasticsearch 1.5 on AWS. The mapping is :-
Mappings
customer
shiptostring
sitegeo_shape
client.search({
index: 'ramcar',
type: 'customer',
body: {
"query":{
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"geo_shape": {
"site": {
"shape": {
"type": "polygon",
"coordinates" :
coordinatespoly
}
}
}
}
}
} //end query
}
The query works fine for somethings, but I want to query a whole bunch of shapes like :-
coordinatespoly = [[151.211172866184,-33.9138219602477],[151.212255333816,-33.9129236397523],[151.211172866184,-33.9138219602477],[151.212255333816,-33.9138219602477],[151.211172866184,-33.9138219602477]]
I tried a simpler version
coordsnoh3 = [[[151.211, -33.914], [151.211, -33.913], [151.212, -33.914], [151.212, -33.913], [151.211, -33.914] ]]
<- 400
{
"error": "SearchPhaseExecutionException[Failed to execute phase [query_fetch], all shards failed; shardFailures {[J-6qXpSMRmi9wsfjgmkzPA][ramcar][0]:SearchParseException[[ramcar][0]: from[-1],size[-1]: Parse Failure [Failed to parse source [{"query":{"filtered":{"query":{"match_all":{}},"filter":{"geo_shape":{"site":{"shape":{"type":"polygon","coordinates":[[[151.211,-33.914],[151.211,-33.913],[151.212,-33.914],[151.212,-33.913],[151.211,-33.914]]]}}}}}}}]]]; nested: InvalidShapeException[Self-intersection at or near point (151.2115, -33.9135, NaN)]; }]",
"status": 400
}
whereas
coordsnoh2 = [[[150.0, -34], [150.0, -33], [151.0, -33], [151.0, -34], [150.0, -34] ]]
works fine
thanks for any advice,
Richard