I'm trying to build a bool query that has multiple 'should' queries
using the Java API (or the groovy API, for that matter), but it isn't
working. I threw together a spock specification to test the behavior
and confirmed it seems to be constructing the should clauses
incorrectly. The spec is here:
It appears that the builder is adding multiple 'should' properties,
and then aggregating their contents incorrectly. In the spec above,
the query generates the following JSON:
As an additional note, I only tried the Java api after I couldn't get
the Groovy dsl to work at all for should clauses. It might be related
to the same bug, but perhaps not. Could anyone post an example of how
to construct a bool query with multiple 'should' queries using the
Groovy query DSL?
The generated json (though not formally json, since it has several elements with the same name, like "should") is fine when it comes to elasticsearch (it supports that in its parsing stage).
On Monday, May 16, 2011 at 8:17 PM, Ellery Crane wrote:
I'm trying to build a bool query that has multiple 'should' queries
using the Java API (or the groovy API, for that matter), but it isn't
working. I threw together a spock specification to test the behavior
and confirmed it seems to be constructing the should clauses
incorrectly. The spec is here:
It appears that the builder is adding multiple 'should' properties,
and then aggregating their contents incorrectly. In the spec above,
the query generates the following JSON:
As an additional note, I only tried the Java api after I couldn't get
the Groovy dsl to work at all for should clauses. It might be related
to the same bug, but perhaps not. Could anyone post an example of how
to construct a bool query with multiple 'should' queries using the
Groovy query DSL?
I get an error when I try to run it. Also, the query json that it
generates is wrong: it puts all the fields into the first should
query, instead of putting each field in the query it was a part of.
The generated json (though not formally json, since it has several elements with the same name, like "should") is fine when it comes to elasticsearch (it supports that in its parsing stage).
On Monday, May 16, 2011 at 8:17 PM, Ellery Crane wrote:
I'm trying to build a bool query that has multiple 'should' queries
using the Java API (or the groovy API, for that matter), but it isn't
working. I threw together a spock specification to test the behavior
and confirmed it seems to be constructing the should clauses
incorrectly. The spec is here:
It appears that the builder is adding multiple 'should' properties,
and then aggregating their contents incorrectly. In the spec above,
the query generates the following JSON:
As an additional note, I only tried the Java api after I couldn't get
the Groovy dsl to work at all for should clauses. It might be related
to the same bug, but perhaps not. Could anyone post an example of how
to construct a bool query with multiple 'should' queries using the
Groovy query DSL?
I get an error when I try to run it. Also, the query json that it
generates is wrong: it puts all the fields into the first should
query, instead of putting each field in the query it was a part of.
Disregard that, evidently- chalk this up to user error The fields
issue was because there was a bug in my test code. I was, however,
seeing exceptions when building a similar query yesterday- I can no
longer produce them today, however; the code hasn't changed, but I am
no longer seeing the errors. Perhaps something in my environment went
awry; if I see them again, I will post a stack trace.
However, if anyone can point me to an example of how to do a should
query using the Groovy DSL, I'd still be interested.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.