Created
January 20, 2015 11:35
-
-
Save xboston/e871c9364292285a4b8c to your computer and use it in GitHub Desktop.
Поиск по elasticsearch с группировкой по полю, одно значение поля - один результат
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
{ | |
"size": 0, | |
"query": { | |
"simple_query_string": { | |
"query": "найди это", | |
"fields": [ | |
"title", | |
"domain", | |
"description", | |
"keywords", | |
"content" | |
] | |
} | |
}, | |
"aggs": { | |
"domain": { | |
"terms": { | |
"field": "domain" | |
}, | |
"aggs": { | |
"blogposts": { | |
"top_hits": { | |
"_source": [ | |
"title", | |
"domain", | |
"description", | |
"keywords", | |
"content" | |
], | |
"size": 1, | |
"highlight": { | |
"fields": { | |
"title": {}, | |
"domain": {}, | |
"description": {}, | |
"keywords": {}, | |
"content": {} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment