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' -d '{
"name": "Garden Kitchen",
"employees": [
{
"firstName": "Joe",
"lastName": "Bloggs",
"state": 1,
"role": 0,
"credentials": [
{
"token": "XXXXX",
"_id": "kOqTUpL",
"uid": "yyyy@yyyy.co.uk"
}
],
"_id": "gl8gnoY",
"email": "yyyy@yyyy.co.uk"
}
]
}'
curl
http://localhost:9200/test/employee/_search?q=employees.credentials.uid:yyyy
Returns the data.
curl -s 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 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
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.
For more options, visit 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.
For more options, visit https://groups.google.com/groups/opt_out.