# Search an array of nested objects

**URL:** <https://discuss.elastic.co/t/search-an-array-of-nested-objects/7111>\
**Category:** Elasticsearch\
**Created:** [March 23, 2012, 8:34pm UTC](https://discuss.elastic.co/t/search-an-array-of-nested-objects/7111 "2012-03-23T20:34:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![James\_Hines](https://avatars.discourse-cdn.com/v4/letter/j/b2d939/32.png) [@James\_Hines](https://discuss.elastic.co/u/James_Hines)\
**Post date:** [March 23, 2012, 8:34pm UTC](https://discuss.elastic.co/t/search-an-array-of-nested-objects/7111/1 "2012-03-23T20:34:17Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![vineeth\_mohan](https://avatars.discourse-cdn.com/v4/letter/v/bc79bd/32.png) [@vineeth\_mohan](https://discuss.elastic.co/u/vineeth_mohan)\
**Post date:** [March 24, 2012, 4:42am UTC](https://discuss.elastic.co/t/search-an-array-of-nested-objects/7111/2 "2012-03-24T04:42:17Z")

</div>

Simply use nested query -

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

Thanks  
Vineeth

On Sat, Mar 24, 2012 at 2:04 AM, James Hines [jhines@pykl.com](mailto: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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 3:35am UTC](https://discuss.elastic.co/t/search-an-array-of-nested-objects/7111/3 "2017-07-06T03:35:02Z")

</div>


