Skip to content

Instantly share code, notes, and snippets.

@tgruben
Created September 17, 2012 20:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tgruben/3739692 to your computer and use it in GitHub Desktop.
Save tgruben/3739692 to your computer and use it in GitHub Desktop.
Issue with Parent Child counting
curl -XPOST http://localhost:9200/parent_child --data-binary @mapping.json
curl -XPOST http://localhost:9200/_bulk --data-binary @bulk.json
curl -XPOST http://localhost:9200/parent_child/profile/_search -d'{"query":{"has_child": {"query": {"term": {"tag": 110475388978628}}, "type": "segment"}}}'
curl -XPOST http://localhost:9200/parent_child/profile/_count -d'{"query":{"has_child": {"query": {"term": {"tag": 110475388978628}}, "type": "segment"}}}'
{ "index" : { "_index" : "parent_child", "_type" : "profile", "_id" : "f92c0f92-354d-11e1-8104-12313806f111" } }
{"gender": "male", "profile_id": "f92c0f92-354d-11e1-8104-12313806f111", "property_id": 9}
{ "index" : { "_index" : "parent_child", "_type" : "segment", "parent" : "f92c0f92-354d-11e1-8104-12313806f111" } }
{"category": [0, 7], "tag": 183824211661952}
{ "index" : { "_index" : "parent_child", "_type" : "segment", "parent" : "f92c0f92-354d-11e1-8104-12313806f111" } }
{"category": [0, 3, 29, 327], "tag": 110475388978628}
{ "index" : { "_index" : "parent_child", "_type" : "segment", "parent" : "f92c0f92-354d-11e1-8104-12313806f111" } }
{"category": [0, 3, 29, 327], "tag": 28627688223}
{ "index" : { "_index" : "parent_child", "_type" : "segment", "parent" : "f92c0f92-354d-11e1-8104-12313806f111" } }
{"category": [0, 7], "tag": 8062627951}
{
"settings": {
"number_of_shards": 1,
"number_of_replicas": 1
},
"mappings": {
"profile": {
"properties": {
"property_id":{
"type":"long"
},
"profile_id": {
"type": "string",
"index":"not_analyzed"
},
"gender": {
"type": "string",
"index":"not_analyzed"
}
}
},
"segment": {
"_parent": { "type": "profile" },
"_timestamp" : { "enabled" : true },
"properties": {
"tag": { "type": "string" },
"category": { "type": "long" }
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment