Search an array of nested objects


(James Hines) #1

I'm trying to create a query that will search an array of nested objects.

Let's assume my JSON document represents a user. My document structure
looks like this:

"first_name": "James",
"last_name": "Hines",
"generalText":[
{
"textTitle":"Lorem ipsum dolor sit amet",
"description":"The quick brown fox jumped over the lazy
dog."
},
{
"textTitle":"Lorem ipsum dolor sit amet",
"description":"The quick brown fox jumped over the lazy
dog."
}
]

I would like to be able query the textTitle and/or the description.


(vineeth mohan) #2

Simply use nested query -
http://www.elasticsearch.org/guide/reference/query-dsl/nested-query.html

Thanks
Vineeth

On Sat, Mar 24, 2012 at 2:04 AM, James Hines jhines@pykl.com wrote:

I'm trying to create a query that will search an array of nested objects.

Let's assume my JSON document represents a user. My document structure
looks like this:

"first_name": "James",
"last_name": "Hines",
"generalText":[
{
"textTitle":"Lorem ipsum dolor sit amet",
"description":"The quick brown fox jumped over the lazy
dog."
},
{
"textTitle":"Lorem ipsum dolor sit amet",
"description":"The quick brown fox jumped over the lazy
dog."
}
]

I would like to be able query the textTitle and/or the description.


(system) #3