Searching fields inside nested object arrays

Hey all,

I'm fairly new to ES and am using it for a new project of mine. Starting off, I have a simple mapping for a customer, which has a first and last name, and a list of payment information objects. If I were doing this in SQL, it would be something like a customer table, and a payment info table with a 1:many relationship.

Here's a simple example of what I'm trying to do: https://gist.github.com/anonymous/6109593

I'm hoping to find any customer based on any match in the nested array of paymentInfos, i.e. finding any users who've had a paymentInfo with billingZip 10101. This query returns no results, and I'm not sure why. Can anyone point me in the right direction as to why this query doesn't work, and if there are any changes I can make to either my query or mapping to have it return the user properly?

Thanks!

First comment: thanks for the gist. It really helps to help you!

I rewrote things here: https://gist.github.com/dadoonet/6113034

Some notes (only to be applied on curl recreation scripts):
Wait for yellow when you create an index
Add a refresh after indexing a document
When searching in nested, use nested filters.

Hope this helps

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 30 juil. 2013 à 04:07, jdyck jeff.c.dyck@gmail.com a écrit :

Hey all,

I'm fairly new to ES and am using it for a new project of mine. Starting
off, I have a simple mapping for a customer, which has a first and last
name, and a list of payment information objects. If I were doing this in
SQL, it would be something like a customer table, and a payment info table
with a 1:many relationship.

Here's a simple example of what I'm trying to do:
https://gist.github.com/anonymous/6109593

I'm hoping to find any customer based on any match in the nested array of
paymentInfos, i.e. finding any users who've had a paymentInfo with
billingZip 10101. This query returns no results, and I'm not sure why. Can
anyone point me in the right direction as to why this query doesn't work,
and if there are any changes I can make to either my query or mapping to
have it return the user properly?

Thanks!

--
View this message in context: http://elasticsearch-users.115913.n3.nabble.com/Searching-fields-inside-nested-object-arrays-tp4038848.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.

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