Created
July 3, 2014 17:52
-
-
Save dadoonet/a04013991566b8a5ec39 to your computer and use it in GitHub Desktop.
Compute terms agg on non analyzed terms.
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
DELETE test | |
PUT test | |
{ | |
"mappings": { | |
"test": { | |
"properties": { | |
"deviceId": { | |
"type": "string", | |
"index": "not_analyzed" | |
}, | |
"basics": { | |
"properties": { | |
"sex": { | |
"type": "string", | |
"index": "not_analyzed" | |
}, | |
"device": { | |
"type": "string", | |
"index": "not_analyzed" | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
PUT /test/test/1 | |
{ | |
"basics": { | |
"sex": "m", | |
"device": "LGE LG-P768" | |
}, | |
"deviceId": "1" | |
} | |
PUT /test/test/2 | |
{ | |
"basics": { | |
"sex": "m", | |
"device": "Samsung SHW-M250S" | |
}, | |
"deviceId": "2" | |
} | |
GET /test/test/_search?search_type=count | |
{ | |
"aggregations": { | |
"popular_devices": { | |
"terms": { | |
"field": "device" | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment