Exception with geoDistanceFilter

Hello there,
I tried to solve this for a while with no success and I'm asking for help
with using the geoDistanceFilter (and this problem happens both on Java as
well as on the REST api).
When I'm using geoDistanceFilter, such as here:
FilterBuilder locationFilter = FilterBuilders.geoDistanceFilter("location")
.point(-71.12163, 42.342587)
.distance(1000, DistanceUnit.METERS);
I'm getting the exception below (Note that if I replace my locationFilter
with FilterBuilders.matchAllFilter() the search works OK with no
exception).
Do you have any idea why I am getting this and how to make it work?
Thanks,
OK

org.elasticsearch.action.search.SearchPhaseExecutionException: Failed to
execute phase [query], all shards failed; shardFailures
{[QXuVaxICQWWe8hf6QV3eDw][stores][4]: RemoteTransportException[[Andrew
Gervais][inet[/67.168.58.25:9302]][search/phase/query]]; nested:
SearchParseException[[stores][4]: from[-1],size[100]: Parse Failure [Failed
to parse source
[{"size":100,"query":{"filtered":{"query":{"match_all":{}},"filter":{"geo_distance":{"location":[42.342587,-71.12163],"distance":"1000.0m"}}}}}]]];
nested: QueryParsingException[[stores] failed to find geo_point field
[location]]; }{[QXuVaxICQWWe8hf6QV3eDw][stores][2]:
RemoteTransportException[[Andrew
Gervais][inet[/68.169.58.25:9302]][search/phase/query]]; nested:
SearchParseException[[stores][2]: from[-1],size[100]: Parse Failure [Failed
to parse source
[{"size":100,"query":{"filtered":{"query":{"match_all":{}},"filter":{"geo_distance":{"location":[42.342587,-71.12163],"distance":"1000.0m"}}}}}]]];
nested: QueryParsingException[[stores] failed to find geo_point field
[location]]; }{[QXuVaxICQWWe8hf6QV3eDw][stores][3]:
RemoteTransportException[[Andrew
Gervais][inet[/68.169.58.25:9302]][search/phase/query]]; nested:
SearchParseException[[stores][3]: from[-1],size[100]: Parse Failure [Failed
to parse source
[{"size":100,"query":{"filtered":{"query":{"match_all":{}},"filter":{"geo_distance":{"location":[42.342587,-71.12163],"distance":"1000.0m"}}}}}]]];
nested: QueryParsingException[[stores] failed to find geo_point field
[location]]; }{[hlytGdVrTi6zoYt2K_9ATw][stores][1]:
SearchParseException[[stores][1]: from[-1],size[100]: Parse Failure [Failed
to parse source
[{"size":100,"query":{"filtered":{"query":{"match_all":{}},"filter":{"geo_distance":{"location":[42.342587,-71.12163],"distance":"1000.0m"}}}}}]]];
nested: QueryParsingException[[stores] failed to find geo_point field
[location]]; }{[QXuVaxICQWWe8hf6QV3eDw][stores][0]:
RemoteTransportException[[Andrew
Gervais][inet[/68.169.58.25:9302]][search/phase/query]]; nested:
SearchParseException[[stores][0]: from[-1],size[100]: Parse Failure [Failed
to parse source
[{"size":100,"query":{"filtered":{"query":{"match_all":{}},"filter":{"geo_distance":{"location":[42.342587,-71.12163],"distance":"1000.0m"}}}}}]]];
nested: QueryParsingException[[stores] failed to find geo_point field
[location]]; }
at
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.onFirstPhaseResult(TransportSearchTypeAction.java:272)
at
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$3.onFailure(TransportSearchTypeAction.java:224)
at
org.elasticsearch.search.action.SearchServiceTransportAction$4.handleException(SearchServiceTransportAction.java:222)
at
org.elasticsearch.transport.netty.MessageChannelHandler.handleException(MessageChannelHandler.java:181)
at
org.elasticsearch.transport.netty.MessageChannelHandler.handlerResponseError(MessageChannelHandler.java:171)
at
org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:123)
at
org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:296)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:462)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:443)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:303)
at
org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:268)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:255)
at
org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:108)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:318)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89)
at
org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)
at
org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
at
org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/f6f9c1c8-288f-4451-88e0-c309a190a0b5%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Hey,

check the exception at the end of your response and its message, it is
basically telling you, that you need to define a geo point for the location
field in your mapping, if you want to use the geo distance filter. Can you
check your mapping, if you maybe missed that?

--Alex

On Tue, Feb 4, 2014 at 5:40 PM, Oren Kagan okagan99@gmail.com wrote:

Hello there,
I tried to solve this for a while with no success and I'm asking for help
with using the geoDistanceFilter (and this problem happens both on Java
as well as on the REST api).
When I'm using geoDistanceFilter, such as here:
FilterBuilder locationFilter = FilterBuilders.geoDistanceFilter("location")
.point(-71.12163, 42.342587)
.distance(1000, DistanceUnit.METERS);
I'm getting the exception below (Note that if I replace my locationFilter
with FilterBuilders.matchAllFilter() the search works OK with no
exception).
Do you have any idea why I am getting this and how to make it work?
Thanks,
OK

org.elasticsearch.action.search.SearchPhaseExecutionException: Failed to
execute phase [query], all shards failed; shardFailures
{[QXuVaxICQWWe8hf6QV3eDw][stores][4]: RemoteTransportException[[Andrew
Gervais][inet[/67.168.58.25:9302]][search/phase/query]]; nested:
SearchParseException[[stores][4]: from[-1],size[100]: Parse Failure
[Failed to parse source
[{"size":100,"query":{"filtered":{"query":{"match_all":{}},"filter":{"geo_distance":{"location":[42.342587,-71.12163],"distance":"1000.0m"}}}}}]]];
nested: QueryParsingException[[stores] failed to find geo_point field
[location]]; }{[QXuVaxICQWWe8hf6QV3eDw][stores][2]:
RemoteTransportException[[Andrew Gervais][inet[/68.169.58.25:9302]][search/phase/query]];
nested: SearchParseException[[stores][2]: from[-1],size[100]: Parse Failure
[Failed to parse source
[{"size":100,"query":{"filtered":{"query":{"match_all":{}},"filter":{"geo_distance":{"location":[42.342587,-71.12163],"distance":"1000.0m"}}}}}]]];
nested: QueryParsingException[[stores] failed to find geo_point field
[location]]; }{[QXuVaxICQWWe8hf6QV3eDw][stores][3]:
RemoteTransportException[[Andrew Gervais][inet[/68.169.58.25:9302]][search/phase/query]];
nested: SearchParseException[[stores][3]: from[-1],size[100]: Parse Failure
[Failed to parse source
[{"size":100,"query":{"filtered":{"query":{"match_all":{}},"filter":{"geo_distance":{"location":[42.342587,-71.12163],"distance":"1000.0m"}}}}}]]];
nested: QueryParsingException[[stores] failed to find geo_point field
[location]]; }{[hlytGdVrTi6zoYt2K_9ATw][stores][1]:
SearchParseException[[stores][1]: from[-1],size[100]: Parse Failure [Failed
to parse source
[{"size":100,"query":{"filtered":{"query":{"match_all":{}},"filter":{"geo_distance":{"location":[42.342587,-71.12163],"distance":"1000.0m"}}}}}]]];
nested: QueryParsingException[[stores] failed to find geo_point field
[location]]; }{[QXuVaxICQWWe8hf6QV3eDw][stores][0]:
RemoteTransportException[[Andrew Gervais][inet[/68.169.58.25:9302]][search/phase/query]];
nested: SearchParseException[[stores][0]: from[-1],size[100]: Parse Failure
[Failed to parse source
[{"size":100,"query":{"filtered":{"query":{"match_all":{}},"filter":{"geo_distance":{"location":[42.342587,-71.12163],"distance":"1000.0m"}}}}}]]];
nested: QueryParsingException[[stores] failed to find geo_point field
[location]]; }
at
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.onFirstPhaseResult(TransportSearchTypeAction.java:272)
at
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$3.onFailure(TransportSearchTypeAction.java:224)
at
org.elasticsearch.search.action.SearchServiceTransportAction$4.handleException(SearchServiceTransportAction.java:222)
at
org.elasticsearch.transport.netty.MessageChannelHandler.handleException(MessageChannelHandler.java:181)
at
org.elasticsearch.transport.netty.MessageChannelHandler.handlerResponseError(MessageChannelHandler.java:171)
at
org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:123)
at
org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:296)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:462)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:443)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:303)
at
org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:268)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:255)
at
org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:108)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:318)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89)
at
org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)
at
org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
at
org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/f6f9c1c8-288f-4451-88e0-c309a190a0b5%40googlegroups.com
.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAGCwEM_s0rNzZ0uzkn-rjKRDXD9kJx1iAqOaKQYt5xydHGWOdw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.