Вопрос

I have a document mapping that looks like this:

_id : integer
title: string
category: string
country: string

Given a search by 'title' i would like to get the amount of results found in all categories and all countries, so something like

countries:
   USA: 38
   UK: 17
   ES: 5
   ....

categories:
   Animals: 6
   People:  772
   Objects: 87
   ....

Is it possible to do this in Elastic Search?

Thanks

Это было полезно?

Решение

Yes, this is the standard behavior for faceting in Elasticsearch. Please refer to the Elasticsearch Facets documentation for more information and examples.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top