How to query related fields of object in array?

Hi,

I am using Solr for the moment, and the fact that everything is indexed as flat field is buggin me. I would like to know the limits of expressiveness of ElasticSearch regarding sub-objects and array query.
For example, can you do a query that involve 2 related field of a subobject. Imagine we have those 2 books indexed:

{
"book" : {
"isbn" : "0812504321"
"name" : "Call of the Wild",
"author" :[ {
"first_name" : "Jack",
"last_name" : "London"
}, {
"first_name" : "Matt",
"last_name" : "Daniels"
}],
},
"book" : {
"isbn" : "0812504321"
"name" : "Call of the Wild",
"author" :[ {
"first_name" : "Jack",
"last_name" : "Daniels"
}, {
"first_name" : "Eric",
"last_name" : "Red"
}],
}

}

How can I express that I want the book which have an author named Jack Daniels ? It should only return the second document.
How can I express that I want the book which have an author which first name is Jack and an author which last name is Daniels ? It should return both documents.

Thanks,
Jean

Hi Jean

How can I express that I want the book which have an author named Jack
Daniels ? It should only return the second document.
How can I express that I want the book which have an author which first name
is Jack and an author which last name is Daniels ? It should return both
documents.

Have a look at this thread

http://elasticsearch-users.115913.n3.nabble.com/Query-all-fields-in-an-embedded-document-td3485229.html

and in particular, this post:

http://elasticsearch-users.115913.n3.nabble.com/Query-all-fields-in-an-embedded-document-tp3485229p3489928.html

clint

Thanks Clint, it is exactly what I was looking for.
The nested feature is marked as experimental on the documentation (
Elasticsearch Platform — Find real-time answers at scale | Elastic). Is
it still the case? Are there still lots of bug? When will it be release as
"production ready"?

Regards,

--
Jean Maynier
Co-founder / Executive Director
eCO2market http://eco2data.com/
tel: +33 9 52 38 19 51
mob: +33 6 11 46 92 31

On Tue, Nov 8, 2011 at 18:21, Clinton Gormley clint@traveljury.com wrote:

Hi Jean

How can I express that I want the book which have an author named Jack
Daniels ? It should only return the second document.
How can I express that I want the book which have an author which first
name
is Jack and an author which last name is Daniels ? It should return both
documents.

Have a look at this thread

http://elasticsearch-users.115913.n3.nabble.com/Query-all-fields-in-an-embedded-document-td3485229.html

and in particular, this post:

http://elasticsearch-users.115913.n3.nabble.com/Query-all-fields-in-an-embedded-document-tp3485229p3489928.html

clint

Hi Jean

On Tue, 2011-11-08 at 19:08 +0100, Jean Maynier wrote:

Thanks Clint, it is exactly what I was looking for.
The nested feature is marked as experimental on the documentation
(Elasticsearch Platform — Find real-time answers at scale | Elastic). Is it still the case? Are there still lots of bug? When will it be release as "production ready"?

I'm using it in production. However, there may yet be corner bugs that
other people haven't come across.

clint

Regards,

--
Jean Maynier
Co-founder / Executive Director
eCO2market http://eco2data.com/

tel: +33 9 52 38 19 51
mob: +33 6 11 46 92 31

On Tue, Nov 8, 2011 at 18:21, Clinton Gormley clint@traveljury.com
wrote:
Hi Jean

    > How can I express that I want the book which have an author
    named  Jack
    > Daniels ? It should only return the second document.
    > How can I express that I want the book which have an author
    which first name
    > is Jack and an author which last name is Daniels ? It should
    return both
    > documents.
    
    
    Have a look at this thread
    
    http://elasticsearch-users.115913.n3.nabble.com/Query-all-fields-in-an-embedded-document-td3485229.html
    
    and in particular, this post:
    
    http://elasticsearch-users.115913.n3.nabble.com/Query-all-fields-in-an-embedded-document-tp3485229p3489928.html
    
    clint