Created
May 3, 2013 06:45
-
-
Save ejain/5507571 to your computer and use it in GitHub Desktop.
Example request and (incorrect) response when using a script terms facet in elasticsearch 0.90.0 (+ lang-javascript 1.3.0).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"query" : { | |
"match_all" : { } | |
}, | |
"facets" : { | |
"lt322cf7ts" : { | |
"terms" : { | |
"size" : 31, | |
"script" : "t=doc['timestamp'].date;t.addMillis(-28800000);v=t.getHourOfDay();v", | |
"lang" : "js" | |
} | |
} | |
} | |
} | |
-- | |
{ | |
"took" : 261, | |
"timed_out" : false, | |
"_shards" : { | |
"total" : 1, | |
"successful" : 1, | |
"failed" : 0 | |
}, | |
"hits" : { | |
"total" : 3, | |
"max_score" : 1.0, | |
"hits" : [ { | |
"_index" : "4oerq1pia8", | |
"_type" : "event", | |
"_id" : "ci7842krt3", | |
"_score" : 1.0, "_source" : {"timestamp":"2012-11-30T15:00:00.000-08:00","@id":"ci7842krt3"} | |
}, { | |
"_index" : "4oerq1pia8", | |
"_type" : "event", | |
"_id" : "ls41ppd5us", | |
"_score" : 1.0, "_source" : {"timestamp":"2012-12-11T15:00:00.000Z","@id":"ls41ppd5us"} | |
}, { | |
"_index" : "4oerq1pia8", | |
"_type" : "event", | |
"_id" : "plc3s8h4rq", | |
"_score" : 1.0, "_source" : {"timestamp":"2012-12-02T15:00:00.000-08:00","@id":"plc3s8h4rq"} | |
} ] | |
}, | |
"facets" : { | |
"lt322cf7ts" : { | |
"_type" : "terms", | |
"missing" : 0, | |
"total" : 3, | |
"other" : 0, | |
"terms" : [ { | |
"term" : "15", | |
"count" : 2 | |
}, { | |
"term" : "7", | |
"count" : 1 | |
} ] | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment