# New to ES. Querying a Document using a path

**URL:** <https://discuss.elastic.co/t/new-to-es-querying-a-document-using-a-path/14084>\
**Category:** Elasticsearch\
**Created:** [October 24, 2013, 8:06am UTC](https://discuss.elastic.co/t/new-to-es-querying-a-document-using-a-path/14084 "2013-10-24T08:06:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Harrigan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/david_harrigan/32/1819_2.png) [@David\_Harrigan](https://discuss.elastic.co/u/David_Harrigan)\
**Post date:** [October 24, 2013, 8:06am UTC](https://discuss.elastic.co/t/new-to-es-querying-a-document-using-a-path/14084/1 "2013-10-24T08:06:01Z")

</div>

Hi,

I put this into IRC, but got no response 🙂 Perhaps to early for people  
🙂

Hi. I'm puzzled about querying ES - just learning about it. I have this  
document as part of an index called "merchants". You can seen an example  
here : [http://pastebin.com/3grwDA2J](http://pastebin.com/3grwDA2J)  
I thought I could do a query like this:

.../\_search?q=employees.credentials.uid:yyyy

Since in my mind, clearly uid is a property of credentials which is a  
property of employees. So I thought I would "walk the path" to narrow the  
search and get the result.

This does not work, i.e., I get no results (based upon the document I have  
shown as an example above).

However when I installed the "elasticsearch-head" plugin, I noticed that ES  
has "flattened" my document, so this search "\_search?q=uid:yyyy" works.

I need help to understand why this is and why doing a what I expected to  
do, i.e., employees.credentials.uid failed.

Does ES index every property of a document, no matter if it's a nested  
array, object, etc.?

Thank you.

-=david=-

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Josh\_Canfield](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/josh_canfield/32/1705_2.png) [@Josh\_Canfield](https://discuss.elastic.co/u/Josh_Canfield)\
**Post date:** [October 24, 2013, 9:00pm UTC](https://discuss.elastic.co/t/new-to-es-querying-a-document-using-a-path/14084/2 "2013-10-24T21:00:12Z")

</div>

Hi David.

The UI for head flattens things, but the mapping should have your structure.  
What you've described should work fine. Here is a working example.

curl -XPOST '[http://localhost:9200/test/employee](http://localhost:9200/test/employee)' -d '{  
"name": "Garden Kitchen",  
"employees": [  
{  
"firstName": "Joe",  
"lastName": "Bloggs",  
"state": 1,  
"role": 0,  
"credentials": [  
{  
"token": "XXXXX",  
"\_id": "kOqTUpL",  
"uid": "[yyyy@yyyy.co.uk](mailto:yyyy@yyyy.co.uk)"  
}  
],  
"\_id": "gl8gnoY",  
"email": "[yyyy@yyyy.co.uk](mailto:yyyy@yyyy.co.uk)"  
}  
]  
}'

curl  
[http://localhost:9200/test/employee/\_search?q=employees.credentials.uid:yyyy](http://localhost:9200/test/employee/_search?q=employees.credentials.uid:yyyy)

Returns the data.

curl -s [http://localhost:9200/test/employee/\_mapping](http://localhost:9200/test/employee/_mapping) | python -m json.tool  
{  
"employee": {  
"properties": {  
"employees": {  
"properties": {  
"\_id": {  
"type": "string"  
},  
"credentials": {  
"properties": {  
"\_id": {  
"type": "string"  
},  
"token": {  
"type": "string"  
},  
"uid": {  
"type": "string"  
}  
}  
},  
"email": {  
"type": "string"  
},  
"firstName": {  
"type": "string"  
},  
"lastName": {  
"type": "string"  
},  
"role": {  
"type": "long"  
},  
"state": {  
"type": "long"  
}  
}  
},  
"name": {  
"type": "string"  
}  
}  
}  
}

Josh

On Thu, Oct 24, 2013 at 1:06 AM, David Harrigan [dharrigan@gmail.com](mailto:dharrigan@gmail.com) wrote:

> Hi,
> 
> I put this into IRC, but got no response 🙂 Perhaps to early for people  
> 🙂
> 
> Hi. I'm puzzled about querying ES - just learning about it. I have this  
> document as part of an index called "merchants". You can seen an example  
> here : [{ "name": "Garden Kitchen", "employees": [{ "firstN - Pastebin.com](http://pastebin.com/3grwDA2J)  
> I thought I could do a query like this:
> 
> .../\_search?q=employees.credentials.uid:yyyy
> 
> Since in my mind, clearly uid is a property of credentials which is a  
> property of employees. So I thought I would "walk the path" to narrow the  
> search and get the result.
> 
> This does not work, i.e., I get no results (based upon the document I have  
> shown as an example above).
> 
> However when I installed the "elasticsearch-head" plugin, I noticed that  
> ES has "flattened" my document, so this search "\_search?q=uid:yyyy" works.
> 
> I need help to understand why this is and why doing a what I expected to  
> do, i.e., employees.credentials.uid failed.
> 
> Does ES index every property of a document, no matter if it's a nested  
> array, object, etc.?
> 
> Thank you.
> 
> -=david=-
> 
> --  
> 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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![David\_Harrigan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/david_harrigan/32/1819_2.png) [@David\_Harrigan](https://discuss.elastic.co/u/David_Harrigan)\
**Post date:** [October 25, 2013, 8:12am UTC](https://discuss.elastic.co/t/new-to-es-querying-a-document-using-a-path/14084/3 "2013-10-25T08:12:36Z")

</div>

Hi,

Thank you for your reply. I don't seem to get results, here is what I get:

curl  
[http://localhost:9200/merchants/\_search?q=employees.credentials.token:xxxx](http://localhost:9200/merchants/_search?q=employees.credentials.token:xxxx)  
{"took":76,"timed\_out":false,"\_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":0,"max\_score":null,"hits":}}

I've put the mapping file here:

> **[$ cat out.txt { "merchants": { "couchbaseCheckpoint": { "proper -...](https://pastebin.com/W8qzgC79)**
>
> Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.

since it's quite big (8K).

I'm quite lost about why I'm not getting results back!

Thank you.

-=david=-

On 24 October 2013 22:00, Josh Canfield [joshcanfield@gmail.com](mailto:joshcanfield@gmail.com) wrote:

> Hi David.
> 
> The UI for head flattens things, but the mapping should have your  
> structure.  
> What you've described should work fine. Here is a working example.
> 
> curl -XPOST '[http://localhost:9200/test/employee](http://localhost:9200/test/employee)' -d '{  
> "name": "Garden Kitchen",  
> "employees": [  
> {  
> "firstName": "Joe",  
> "lastName": "Bloggs",  
> "state": 1,  
> "role": 0,  
> "credentials": [  
> {  
> "token": "XXXXX",  
> "\_id": "kOqTUpL",  
> "uid": "[yyyy@yyyy.co.uk](mailto:yyyy@yyyy.co.uk)"  
> }  
> ],  
> "\_id": "gl8gnoY",  
> "email": "[yyyy@yyyy.co.uk](mailto:yyyy@yyyy.co.uk)"  
> }  
> ]  
> }'
> 
> curl  
> [http://localhost:9200/test/employee/\_search?q=employees.credentials.uid:yyyy](http://localhost:9200/test/employee/_search?q=employees.credentials.uid:yyyy)
> 
> Returns the data.
> 
> curl -s [http://localhost:9200/test/employee/\_mapping](http://localhost:9200/test/employee/_mapping) | python -m json.tool  
> {  
> "employee": {  
> "properties": {  
> "employees": {  
> "properties": {  
> "\_id": {  
> "type": "string"  
> },  
> "credentials": {  
> "properties": {  
> "\_id": {  
> "type": "string"  
> },  
> "token": {  
> "type": "string"  
> },  
> "uid": {  
> "type": "string"  
> }  
> }  
> },  
> "email": {  
> "type": "string"  
> },  
> "firstName": {  
> "type": "string"  
> },  
> "lastName": {  
> "type": "string"  
> },  
> "role": {  
> "type": "long"  
> },  
> "state": {  
> "type": "long"  
> }  
> }  
> },  
> "name": {  
> "type": "string"  
> }  
> }  
> }  
> }
> 
> Josh
> 
> On Thu, Oct 24, 2013 at 1:06 AM, David Harrigan [dharrigan@gmail.com](mailto:dharrigan@gmail.com)wrote:
> 
> > Hi,
> > 
> > I put this into IRC, but got no response 🙂 Perhaps to early for people  
> > 🙂
> > 
> > Hi. I'm puzzled about querying ES - just learning about it. I have this  
> > document as part of an index called "merchants". You can seen an example  
> > here : [{ "name": "Garden Kitchen", "employees": [{ "firstN - Pastebin.com](http://pastebin.com/3grwDA2J)  
> > I thought I could do a query like this:
> > 
> > .../\_search?q=employees.credentials.uid:yyyy
> > 
> > Since in my mind, clearly uid is a property of credentials which is a  
> > property of employees. So I thought I would "walk the path" to narrow the  
> > search and get the result.
> > 
> > This does not work, i.e., I get no results (based upon the document I  
> > have shown as an example above).
> > 
> > However when I installed the "elasticsearch-head" plugin, I noticed that  
> > ES has "flattened" my document, so this search "\_search?q=uid:yyyy" works.
> > 
> > I need help to understand why this is and why doing a what I expected to  
> > do, i.e., employees.credentials.uid failed.
> > 
> > Does ES index every property of a document, no matter if it's a nested  
> > array, object, etc.?
> > 
> > Thank you.
> > 
> > -=david=-
> > 
> > --  
> > 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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/Gmj57LU\_zR8/unsubscribe](https://groups.google.com/d/topic/elasticsearch/Gmj57LU_zR8/unsubscribe).  
> To unsubscribe from this group and all its topics, send an email to  
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
I prefer encrypted and signed messages. KeyID: B20A22F9  
Fingerprint: 110A F423 3647 54E2 880F ADAD 1C52 85BF B20A 22F9

"It is not usually until you've built and used a version of the program  
that you understand the issues well enough to get the design right." - Rob  
Pike, Brian Kernighan.

No trees were harmed in the sending of this message, however, a number of  
electrons were inconvenienced.

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [October 25, 2013, 12:00pm UTC](https://discuss.elastic.co/t/new-to-es-querying-a-document-using-a-path/14084/4 "2013-10-25T12:00:54Z")

</div>

From your mapping, it looks like `employees.credentials.uid` is not the  
full path name. It is in fact: `doc.employees.credentials.uid` or, if you  
include the type name: `couchbaseDocument.doc.employees.credentials.uid`

This is a peculiarity of how couchbase maps its documents to elasticsearch.  
It shifts the document itself under `doc` because it adds a `meta` element  
as well.

On 25 October 2013 10:12, David Harrigan [dharrigan@gmail.com](mailto:dharrigan@gmail.com) wrote:

> Hi,
> 
> Thank you for your reply. I don't seem to get results, here is what I get:
> 
> curl  
> [http://localhost:9200/merchants/\_search?q=employees.credentials.token:xxxx](http://localhost:9200/merchants/_search?q=employees.credentials.token:xxxx)
> 
> {"took":76,"timed\_out":false,"\_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":0,"max\_score":null,"hits":}}
> 
> I've put the mapping file here:
> 
> [$ cat out.txt { "merchants": { "couchbaseCheckpoint": { "proper - Pastebin.com](http://pastebin.com/W8qzgC79)
> 
> since it's quite big (8K).
> 
> I'm quite lost about why I'm not getting results back!
> 
> Thank you.
> 
> -=david=-
> 
> On 24 October 2013 22:00, Josh Canfield [joshcanfield@gmail.com](mailto:joshcanfield@gmail.com) wrote:
> 
> > Hi David.
> > 
> > The UI for head flattens things, but the mapping should have your  
> > structure.  
> > What you've described should work fine. Here is a working example.
> > 
> > curl -XPOST '[http://localhost:9200/test/employee](http://localhost:9200/test/employee)' -d '{  
> > "name": "Garden Kitchen",  
> > "employees": [  
> > {  
> > "firstName": "Joe",  
> > "lastName": "Bloggs",  
> > "state": 1,  
> > "role": 0,  
> > "credentials": [  
> > {  
> > "token": "XXXXX",  
> > "\_id": "kOqTUpL",  
> > "uid": "[yyyy@yyyy.co.uk](mailto:yyyy@yyyy.co.uk)"  
> > }  
> > ],  
> > "\_id": "gl8gnoY",  
> > "email": "[yyyy@yyyy.co.uk](mailto:yyyy@yyyy.co.uk)"  
> > }  
> > ]  
> > }'
> > 
> > curl  
> > [http://localhost:9200/test/employee/\_search?q=employees.credentials.uid:yyyy](http://localhost:9200/test/employee/_search?q=employees.credentials.uid:yyyy)
> > 
> > Returns the data.
> > 
> > curl -s [http://localhost:9200/test/employee/\_mapping](http://localhost:9200/test/employee/_mapping) | python -m  
> > json.tool  
> > {  
> > "employee": {  
> > "properties": {  
> > "employees": {  
> > "properties": {  
> > "\_id": {  
> > "type": "string"  
> > },  
> > "credentials": {  
> > "properties": {  
> > "\_id": {  
> > "type": "string"  
> > },  
> > "token": {  
> > "type": "string"  
> > },  
> > "uid": {  
> > "type": "string"  
> > }  
> > }  
> > },  
> > "email": {  
> > "type": "string"  
> > },  
> > "firstName": {  
> > "type": "string"  
> > },  
> > "lastName": {  
> > "type": "string"  
> > },  
> > "role": {  
> > "type": "long"  
> > },  
> > "state": {  
> > "type": "long"  
> > }  
> > }  
> > },  
> > "name": {  
> > "type": "string"  
> > }  
> > }  
> > }  
> > }
> > 
> > Josh
> > 
> > On Thu, Oct 24, 2013 at 1:06 AM, David Harrigan [dharrigan@gmail.com](mailto:dharrigan@gmail.com)wrote:
> > 
> > > Hi,
> > > 
> > > I put this into IRC, but got no response 🙂 Perhaps to early for people  
> > > 🙂
> > > 
> > > Hi. I'm puzzled about querying ES - just learning about it. I have this  
> > > document as part of an index called "merchants". You can seen an example  
> > > here : [{ "name": "Garden Kitchen", "employees": [{ "firstN - Pastebin.com](http://pastebin.com/3grwDA2J)  
> > > I thought I could do a query like this:
> > > 
> > > .../\_search?q=employees.credentials.uid:yyyy
> > > 
> > > Since in my mind, clearly uid is a property of credentials which is a  
> > > property of employees. So I thought I would "walk the path" to narrow the  
> > > search and get the result.
> > > 
> > > This does not work, i.e., I get no results (based upon the document I  
> > > have shown as an example above).
> > > 
> > > However when I installed the "elasticsearch-head" plugin, I noticed that  
> > > ES has "flattened" my document, so this search "\_search?q=uid:yyyy" works.
> > > 
> > > I need help to understand why this is and why doing a what I expected to  
> > > do, i.e., employees.credentials.uid failed.
> > > 
> > > Does ES index every property of a document, no matter if it's a nested  
> > > array, object, etc.?
> > > 
> > > Thank you.
> > > 
> > > -=david=-
> > > 
> > > --  
> > > 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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> > 
> > --  
> > You received this message because you are subscribed to a topic in the  
> > Google Groups "elasticsearch" group.  
> > To unsubscribe from this topic, visit  
> > [https://groups.google.com/d/topic/elasticsearch/Gmj57LU\_zR8/unsubscribe](https://groups.google.com/d/topic/elasticsearch/Gmj57LU_zR8/unsubscribe).  
> > To unsubscribe from this group and all its topics, send an email to  
> > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).
> > 
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> I prefer encrypted and signed messages. KeyID: B20A22F9  
> Fingerprint: 110A F423 3647 54E2 880F ADAD 1C52 85BF B20A 22F9
> 
> "It is not usually until you've built and used a version of the program  
> that you understand the issues well enough to get the design right." - Rob  
> Pike, Brian Kernighan.
> 
> No trees were harmed in the sending of this message, however, a number of  
> electrons were inconvenienced.
> 
> --  
> 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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![David\_Harrigan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/david_harrigan/32/1819_2.png) [@David\_Harrigan](https://discuss.elastic.co/u/David_Harrigan)\
**Post date:** [October 25, 2013, 1:13pm UTC](https://discuss.elastic.co/t/new-to-es-querying-a-document-using-a-path/14084/5 "2013-10-25T13:13:01Z")

</div>

Hi,

Thank you for that. When I put doc. in front of the query it worked, so I  
understand now why it failed originally. Thank you very much Clinton and  
Josh for your replies 🙂

-=david=-

On 25 October 2013 13:00, Clinton Gormley [clint@traveljury.com](mailto:clint@traveljury.com) wrote:

> From your mapping, it looks like `employees.credentials.uid` is not the  
> full path name. It is in fact: `doc.employees.credentials.uid` or, if you  
> include the type name: `couchbaseDocument.doc.employees.credentials.uid`
> 
> This is a peculiarity of how couchbase maps its documents to  
> elasticsearch. It shifts the document itself under `doc` because it adds a  
> `meta` element as well.
> 
> On 25 October 2013 10:12, David Harrigan [dharrigan@gmail.com](mailto:dharrigan@gmail.com) wrote:
> 
> > Hi,
> > 
> > Thank you for your reply. I don't seem to get results, here is what I get:
> > 
> > curl  
> > [http://localhost:9200/merchants/\_search?q=employees.credentials.token:xxxx](http://localhost:9200/merchants/_search?q=employees.credentials.token:xxxx)
> > 
> > {"took":76,"timed\_out":false,"\_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":0,"max\_score":null,"hits":}}
> > 
> > I've put the mapping file here:
> > 
> > [$ cat out.txt { "merchants": { "couchbaseCheckpoint": { "proper - Pastebin.com](http://pastebin.com/W8qzgC79)
> > 
> > since it's quite big (8K).
> > 
> > I'm quite lost about why I'm not getting results back!
> > 
> > Thank you.
> > 
> > -=david=-
> > 
> > On 24 October 2013 22:00, Josh Canfield [joshcanfield@gmail.com](mailto:joshcanfield@gmail.com) wrote:
> > 
> > > Hi David.
> > > 
> > > The UI for head flattens things, but the mapping should have your  
> > > structure.  
> > > What you've described should work fine. Here is a working example.
> > > 
> > > curl -XPOST '[http://localhost:9200/test/employee](http://localhost:9200/test/employee)' -d '{  
> > > "name": "Garden Kitchen",  
> > > "employees": [  
> > > {  
> > > "firstName": "Joe",  
> > > "lastName": "Bloggs",  
> > > "state": 1,  
> > > "role": 0,  
> > > "credentials": [  
> > > {  
> > > "token": "XXXXX",  
> > > "\_id": "kOqTUpL",  
> > > "uid": "[yyyy@yyyy.co.uk](mailto:yyyy@yyyy.co.uk)"  
> > > }  
> > > ],  
> > > "\_id": "gl8gnoY",  
> > > "email": "[yyyy@yyyy.co.uk](mailto:yyyy@yyyy.co.uk)"  
> > > }  
> > > ]  
> > > }'
> > > 
> > > curl  
> > > [http://localhost:9200/test/employee/\_search?q=employees.credentials.uid:yyyy](http://localhost:9200/test/employee/_search?q=employees.credentials.uid:yyyy)
> > > 
> > > Returns the data.
> > > 
> > > curl -s [http://localhost:9200/test/employee/\_mapping](http://localhost:9200/test/employee/_mapping) | python -m  
> > > json.tool  
> > > {  
> > > "employee": {  
> > > "properties": {  
> > > "employees": {  
> > > "properties": {  
> > > "\_id": {  
> > > "type": "string"  
> > > },  
> > > "credentials": {  
> > > "properties": {  
> > > "\_id": {  
> > > "type": "string"  
> > > },  
> > > "token": {  
> > > "type": "string"  
> > > },  
> > > "uid": {  
> > > "type": "string"  
> > > }  
> > > }  
> > > },  
> > > "email": {  
> > > "type": "string"  
> > > },  
> > > "firstName": {  
> > > "type": "string"  
> > > },  
> > > "lastName": {  
> > > "type": "string"  
> > > },  
> > > "role": {  
> > > "type": "long"  
> > > },  
> > > "state": {  
> > > "type": "long"  
> > > }  
> > > }  
> > > },  
> > > "name": {  
> > > "type": "string"  
> > > }  
> > > }  
> > > }  
> > > }
> > > 
> > > Josh
> > > 
> > > On Thu, Oct 24, 2013 at 1:06 AM, David Harrigan [dharrigan@gmail.com](mailto:dharrigan@gmail.com)wrote:
> > > 
> > > > Hi,
> > > > 
> > > > I put this into IRC, but got no response 🙂 Perhaps to early for  
> > > > people 🙂
> > > > 
> > > > Hi. I'm puzzled about querying ES - just learning about it. I have this  
> > > > document as part of an index called "merchants". You can seen an example  
> > > > here : [{ "name": "Garden Kitchen", "employees": [{ "firstN - Pastebin.com](http://pastebin.com/3grwDA2J)  
> > > > I thought I could do a query like this:
> > > > 
> > > > .../\_search?q=employees.credentials.uid:yyyy
> > > > 
> > > > Since in my mind, clearly uid is a property of credentials which is a  
> > > > property of employees. So I thought I would "walk the path" to narrow the  
> > > > search and get the result.
> > > > 
> > > > This does not work, i.e., I get no results (based upon the document I  
> > > > have shown as an example above).
> > > > 
> > > > However when I installed the "elasticsearch-head" plugin, I noticed  
> > > > that ES has "flattened" my document, so this search "\_search?q=uid:yyyy"  
> > > > works.
> > > > 
> > > > I need help to understand why this is and why doing a what I expected  
> > > > to do, i.e., employees.credentials.uid failed.
> > > > 
> > > > Does ES index every property of a document, no matter if it's a nested  
> > > > array, object, etc.?
> > > > 
> > > > Thank you.
> > > > 
> > > > -=david=-
> > > > 
> > > > --  
> > > > 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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> > > 
> > > --  
> > > You received this message because you are subscribed to a topic in the  
> > > Google Groups "elasticsearch" group.  
> > > To unsubscribe from this topic, visit  
> > > [https://groups.google.com/d/topic/elasticsearch/Gmj57LU\_zR8/unsubscribe](https://groups.google.com/d/topic/elasticsearch/Gmj57LU_zR8/unsubscribe).  
> > > To unsubscribe from this group and all its topics, send an email to  
> > > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).
> > > 
> > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> > 
> > --  
> > I prefer encrypted and signed messages. KeyID: B20A22F9  
> > Fingerprint: 110A F423 3647 54E2 880F ADAD 1C52 85BF B20A 22F9
> > 
> > "It is not usually until you've built and used a version of the program  
> > that you understand the issues well enough to get the design right." - Rob  
> > Pike, Brian Kernighan.
> > 
> > No trees were harmed in the sending of this message, however, a number of  
> > electrons were inconvenienced.
> > 
> > --  
> > 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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/Gmj57LU\_zR8/unsubscribe](https://groups.google.com/d/topic/elasticsearch/Gmj57LU_zR8/unsubscribe).  
> To unsubscribe from this group and all its topics, send an email to  
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
I prefer encrypted and signed messages. KeyID: B20A22F9  
Fingerprint: 110A F423 3647 54E2 880F ADAD 1C52 85BF B20A 22F9

"It is not usually until you've built and used a version of the program  
that you understand the issues well enough to get the design right." - Rob  
Pike, Brian Kernighan.

No trees were harmed in the sending of this message, however, a number of  
electrons were inconvenienced.

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:10am UTC](https://discuss.elastic.co/t/new-to-es-querying-a-document-using-a-path/14084/6 "2017-07-06T02:10:35Z")

</div>


