Skip to content

Instantly share code, notes, and snippets.

/data.js Secret

Created May 22, 2012 18:55
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 anonymous/99ca2a71742774d9786b to your computer and use it in GitHub Desktop.
Save anonymous/99ca2a71742774d9786b to your computer and use it in GitHub Desktop.
Elastic search - facet on nested object
{
"obj1":[
{
"date":"2012-01-01T00:02:00Z",
"id":4
},
{
"date":"2012-01-01T02:11:00Z",
"id":6
}
]
}
{
"type1":{
"properties":{
"obj1":{
"type":"nested",
"properties":{
"date":{
"type":"date",
"format":"dateOptionalTime",
"include_in_all":false
},
"id":{
"type":"long",
"include_in_all":false
}
}
}
}
}
}
{
"facets":{
"facet1":{
"date_histogram":{
"field":"date",
"interval":"hour"
},
"nested":"obj1"
}
}
}
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [ {
"_index" : "test",
"_type" : "type1",
"_id" : "1",
"_score" : 1.0, "_source" : {"obj1" : [{"date" : "2012-01-01T00:02:00Z","id" : 4},{"date" : "2012-01-01T02:11:00Z","id" : 6}]}
} ]
},
"facets" : {
"facet1" : {
"_type" : "date_histogram",
"entries" : [ ]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment