Query run via Java API fails


(Kyle Pinette) #1

Hey Guys,

I'm trying to use the Query / Filter Builder objects with the Java API.
However, when I execute a query using these it is failing. If I take the
JSON output that the Query / Filter Builders generate and run them via the
REST API, the query succeeds. I have no clue how to debug what is going on
here.

The error message I'm getting is:

nested: QueryParsingException[[db_name] Failed to find geo_shape field

[searchGeometry]]

As you can see here, the geo_shape mapping does exist:

Also, here is the query:

Any help would be much appreciated.

-Kyle

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(Kyle Pinette) #2

For now, I've worked around this by not using the query builders, but by
generating the JSON for queries using XContentBuilder.

On Monday, November 11, 2013 10:22:42 AM UTC-5, Kyle Pinette wrote:

Hey Guys,

I'm trying to use the Query / Filter Builder objects with the Java API.
However, when I execute a query using these it is failing. If I take the
JSON output that the Query / Filter Builders generate and run them via the
REST API, the query succeeds. I have no clue how to debug what is going on
here.

The error message I'm getting is:

nested: QueryParsingException[[db_name] Failed to find geo_shape field

[searchGeometry]]

As you can see here, the geo_shape mapping does exist:

https://gist.github.com/sowelie/2e626fc6cfd8d9f91c8a

Also, here is the query:

https://gist.github.com/sowelie/f74fc81b7e957b5d2022

Any help would be much appreciated.

-Kyle

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(Luca Cavanna) #3

Would be nice to understand what the problem was and fix it. Can you maybe
post the java code that triggers the error?

On Monday, November 11, 2013 6:33:12 PM UTC+1, Kyle Pinette wrote:

For now, I've worked around this by not using the query builders, but by
generating the JSON for queries using XContentBuilder.

On Monday, November 11, 2013 10:22:42 AM UTC-5, Kyle Pinette wrote:

Hey Guys,

I'm trying to use the Query / Filter Builder objects with the Java API.
However, when I execute a query using these it is failing. If I take the
JSON output that the Query / Filter Builders generate and run them via the
REST API, the query succeeds. I have no clue how to debug what is going on
here.

The error message I'm getting is:

nested: QueryParsingException[[db_name] Failed to find geo_shape field

[searchGeometry]]

As you can see here, the geo_shape mapping does exist:

https://gist.github.com/sowelie/2e626fc6cfd8d9f91c8a

Also, here is the query:

https://gist.github.com/sowelie/f74fc81b7e957b5d2022

Any help would be much appreciated.

-Kyle

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(Brian Yoder) #4

Hi, Kyle.

One thing to try in your Java code is to call the toString method of the
top-level QueryBuilder. This creates a pretty-printed JSON string that
matches the Java query.

Brian

On Monday, November 11, 2013 12:33:12 PM UTC-5, Kyle Pinette wrote:

For now, I've worked around this by not using the query builders, but by
generating the JSON for queries using XContentBuilder.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(Kyle Pinette) #5

Guys,

I think the error message I posted was not the correct error message, there
were multiple calls being made and it seems this was an error related to a
different call.

For now, I've changed my code to generate the queries manually using
XContentBuilder and this seems to work fine. If I decide to be brave and
go back to using the QueryBuilders, I'll post a response here.

Thanks,

Kyle

On Wednesday, November 13, 2013 11:01:30 AM UTC-5, InquiringMind wrote:

Hi, Kyle.

One thing to try in your Java code is to call the toString method of the
top-level QueryBuilder. This creates a pretty-printed JSON string that
matches the Java query.

Brian

On Monday, November 11, 2013 12:33:12 PM UTC-5, Kyle Pinette wrote:

For now, I've worked around this by not using the query builders, but by
generating the JSON for queries using XContentBuilder.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #6