Multi-field query syntax

I'm struggling with ES syntax right now. Is there a way to match
e.g. term A against field A and term B against field B in a simple
boolean query?

The gist below "works" as in "returns the appropriate entries" using
sense as the client (despite sense complaining about the duplicate
"must") - but it doesn't feel right and it's not DRY.

What's the proper way to do this?

TIA!

H*

Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
http://about.me/hassanschroeder
twitter: @hassan

--
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.

Hey,

good if it works! In order to improve slightly you could make the must
field an array which contains your queries.

--Alex

On Tue, Jul 16, 2013 at 10:11 PM, Hassan Schroeder <
hassan.schroeder@gmail.com> wrote:

I'm struggling with ES syntax right now. Is there a way to match
e.g. term A against field A and term B against field B in a simple
boolean query?

The gist below "works" as in "returns the appropriate entries" using
sense as the client (despite sense complaining about the duplicate
"must") - but it doesn't feel right and it's not DRY.

https://gist.github.com/hassan/16e48838886109c4b2bb

What's the proper way to do this?

TIA!

H*

Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
http://about.me/hassanschroeder
twitter: @hassan

--
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.

--
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.

On Tue, Jul 16, 2013 at 11:19 PM, Alexander Reelsen alr@spinscale.de wrote:

good if it works! In order to improve slightly you could make the must field
an array which contains your queries.

Uh, yeah, that's what I'd like to do -- but what does that look like?
I thought I understood JSON format but NOTHING I can come up
with results in anything but errors like

QueryParsingException[[resources] [match] query malformed, no field]

A working example would be extremely helpful (and a good thing to
add to the docs, I'd think).

I'm using ES 0.90.0, BTW, in case this is a known problem.

TIA,

Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
http://about.me/hassanschroeder
twitter: @hassan

--
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.

I recommend to use suche plugin- GUIs like
http://mobz.github.io/elasticsearch-head/


or an other gui like

With Chrome, FireFox,.. you can take a look at the generated JSON.

Hope this helps

--
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.

I recommend to use such plugin- GUIs like
http://mobz.github.io/elasticsearch-head/


or an other gui like

With Chrome, FireFox,.. you can take a look at the generated JSON.

Hope this helps

--
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.

On Wed, Jul 17, 2013 at 5:24 AM, Christian Th. chth.exensio@gmail.com wrote:

I recommend to use such plugin- GUIs like
http://mobz.github.io/elasticsearch-head/
https://github.com/jettro/elasticsearch-gui
or an other gui like
https://github.com/okfn/facetview

With Chrome, FireFox,.. you can take a look at the generated JSON.

Hope this helps

Thank you, yes -- seeing some generated queries shed light on
my issue (which wasn't actually json-format-related), though now
I apparently need to go back to the docs for a little more study :slight_smile:

Thanks again,

H*

Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
http://about.me/hassanschroeder
twitter: @hassan

--
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.