Elastic search search by geolocation


(vernik23) #1

Hi List!!

I have an exception but the posible problem is a mapping but in this case the mapping is correct "location":{"type":"geo_point"}

My method:
public List searchByLatAndLong(Double lat, Double lon){
List result = new ArrayList();
SearchRequestBuilder srb = client.prepareSearch("cp-provider-local_c");
srb.setQuery(QueryBuilders.matchAllQuery());
GeoDistanceFilterBuilder filter = FilterBuilders.geoDistanceFilter("point").distance("200.0km").lat(lat).lon(lon).geoDistance(GeoDistance.ARC);
SearchResponse response = srb.execute().actionGet();
for (SearchHit hit : response.getHits().getHits()) {
result.add(hit.getId());
}

	return result;
}

Exception:

org.elasticsearch.action.search.SearchPhaseExecutionException: Failed to execute phase [query], total failure; shardFailures {[ndq67oOWRZqysGpcheN58g][cp-provider-local_c][3]: RemoteTransportException[[Avarrish][inet[/10.80.136.17:9300]][search/phase/query]]; nested: SearchParseException[[cp-provider-local_c][3]: from[-1],size[-1]: Parse Failure [Failed to parse source [:slight_smile:
?ery?ltered?wrapper?{"match_all":{}}?ilter?o_distance?int?k; ,ig4)

Please any idea??

Thanks
VerĂ³nica!


(system) #2