I was more thinking of something like:
{
"query": {
"bool": {
"must": [
{
"nested": {
"path": "path_to_nested_doc",
"query": {}
}
},{
"nested": {
"path": "path_to_nested_doc",
"query": {}
}
}
]
}
}
}
First nested for tuples.key=name && tuples.value=myentityName
Second nested for tuples.key=uri && tuples.value=http://myentityName/uri
Hope this help
--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr
Le 27 novembre 2013 at 23:48:36, tmanta7@gmail.com (tmanta7@gmail.com) a écrit:
Thanks for your help David.
Ok so I simplified my expression:
{
"facets": {
"terms": {
"terms": {
"field": "kv.value",
"size": 10,
"order": "count",
"exclude": []
},
"facet_filter": {
"fquery": {
"query": {
"filtered": {
"query": {
"nested": {
"path": "kv",
"query": {
"bool": {
"must" : [ { "text" :
{ "kv.key" : "state"}
},
{ "text" :
{ "kv.value" : "designed"}
}
]
}
}
}
}
}
}
}
}
}
},
"size": 0
}
But it still does not work
To summarize the goal is to realize a facet on nested fields (using Kibana)
Le mercredi 27 novembre 2013 07:22:48 UTC+1, David Pilato a écrit :
Did you try a BoolQuery with 2 nested queries inside?
--
David
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
Le 27 nov. 2013 à 04:29, Corey Nolet cjn...@gmail.com a écrit :
My data has the following format:
{
"id": "entityId",
"type": "entityType",
"tuples": [
{
"key": "name",
"value": "myentityName",
"type": "string"
},
{
"key": "url",
"value": "http://myentityName/uri",
"type": "uri"
}
],
"_timestamp": "2013090211"
}
What I need is the ability to, in this format, query for all entities that have both a "tuples.key=name && tuples.value=myentityName" and "tuples.key=uri && tuples.value=http://myentityName/uri". I haven't been able to find a good example in the nested query API documentation as the most I've seen people matching would be a single nested document. I'm using elasticsearch as a realtime cache where the entities get stored for an hour before they get pushed to an archive in HBase. The document format above lends itself well to the key/value indexes i've established in HBase and it'd be nice if I could keep the same document format for both databases.
Thanks in advance for help!
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/52c18f30-751c-40d9-9096-a4690258ac83%40googlegroups.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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/etPan.52967841.6ceaf087.3e14%40MacBook-Air-de-David.local.
For more options, visit https://groups.google.com/groups/opt_out.