# Querying a complex doc in elasticsearch

**URL:** <https://discuss.elastic.co/t/querying-a-complex-doc-in-elasticsearch/94729>\
**Category:** Elasticsearch\
**Created:** [July 27, 2017, 3:54am UTC](https://discuss.elastic.co/t/querying-a-complex-doc-in-elasticsearch/94729 "2017-07-27T03:54:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pika](https://avatars.discourse-cdn.com/v4/letter/p/ce73a5/32.png) [@pika](https://discuss.elastic.co/u/pika)\
**Post date:** [July 27, 2017, 3:54am UTC](https://discuss.elastic.co/t/querying-a-complex-doc-in-elasticsearch/94729/1 "2017-07-27T03:54:10Z")

</div>

Hello,  
I am new in the world of elasticsearch.

We are dealing in our project with complex docs that we store in our elasticsearch database.

This is a part of our doc:  
"AAA": [  
{  
"SSS": {  
"Description": {  
"Detail": [  
{  
"Name": "A9",  
"Infos": "...."  
},  
{  
"Name": "A8",  
"Infos": "...."  
},  
{  
"Name": "A7",  
"Infos": "...."  
},  
{  
"Name": "A6",  
"Infos": "...."  
},  
{  
"Name": "A5",  
"Infos": "...."  
},  
{  
"Name": "A4",  
"Infos": "...."  
},  
{  
"Name": "A3"  
"Infos": "...."  
},  
{  
"Name": "A2",  
"Infos": "...."  
},  
{  
"Name": "A1",  
"Infos": "...."  
}  
]  
}  
}  
}  
]  
}

I want a query that return the " Infos" & "Name" fields specific to "Name":"A1" for example.  
In other terms I want a query that return this part of the doc:  
"AAA": [  
{  
"SSS": {  
"Description": {  
"Detail": [  
{  
"Name": "A1",  
"Infos": "...."  
}  
]  
}  
}  
}  
]  
I am trying all the day and it didn't work for me.  
Can anyone help me.  
Thanks in advance.

---

<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:** [August 24, 2017, 3:59am UTC](https://discuss.elastic.co/t/querying-a-complex-doc-in-elasticsearch/94729/2 "2017-08-24T03:59:33Z")

</div>

Closed on August 24, 2017, 3:59am UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
