Last active
October 14, 2016 09:22
-
-
Save clintongormley/07662b244a1c59eaa3dc2c40fd458347 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
PUT t | |
{ | |
"mappings": { | |
"t": { | |
"properties": { | |
"bool": { | |
"type": "boolean" | |
} | |
} | |
} | |
} | |
} | |
PUT t/t/1 | |
{"bool":true} | |
PUT t/t/2 | |
{"bool":false} | |
GET t/_search | |
{ | |
"_source": "bool", | |
"script_fields": { | |
"bool": { | |
"script": "doc['bool'].value ? 'true' : 'false'" | |
} | |
}, | |
"aggs": { | |
"bool": { | |
"meta": { | |
"is_boolean": true | |
}, | |
"terms": { | |
"field": "bool" | |
} | |
} | |
} | |
} |
This file contains hidden or 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
{ | |
"took": 6, | |
"timed_out": false, | |
"_shards": { | |
"total": 5, | |
"successful": 5, | |
"failed": 0 | |
}, | |
"hits": { | |
"total": 2, | |
"max_score": 1, | |
"hits": [ | |
{ | |
"_index": "t", | |
"_type": "t", | |
"_id": "2", | |
"_score": 1, | |
"_source": { | |
"bool": false | |
}, | |
"fields": { | |
"bool": [ | |
"false" | |
] | |
} | |
}, | |
{ | |
"_index": "t", | |
"_type": "t", | |
"_id": "1", | |
"_score": 1, | |
"_source": { | |
"bool": true | |
}, | |
"fields": { | |
"bool": [ | |
"true" | |
] | |
} | |
} | |
] | |
}, | |
"aggregations": { | |
"bool": { | |
"meta": { | |
"is_boolean": true | |
}, | |
"doc_count_error_upper_bound": 0, | |
"sum_other_doc_count": 0, | |
"buckets": [ | |
{ | |
"key": 0, | |
"key_as_string": "false", | |
"doc_count": 1 | |
}, | |
{ | |
"key": 1, | |
"key_as_string": "true", | |
"doc_count": 1 | |
} | |
] | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment