How to get Facet for two field concatenation


(vibin) #1

Hi,

I'm new to Elastic Search facets. And I'm aware of getting the count
of a field by applying addFacet, but I wonder if there is a
possibility of getting facet count by specifying 2 fields( I mean AND
operator in Facet).

For example,

Field1 Field2

1 a
1 b
1 a
2 a
2 b

Is it possible to get the results as below,

FacetTerm Count

1,a 2
1,b 1
2,a 1
2,b 1


(Ivan Brusic) #2

The term facet supports Multi Fields: "The term facet can be executed
against more than one field, returning the aggregation result across
those fields"

http://www.elasticsearch.org/guide/reference/api/search/facets/terms-facet.html

Term Scripts will give you more control/flexibility.

--
Ivan

On Thu, Mar 15, 2012 at 4:00 AM, vibin dhas vibindhas@gmail.com wrote:

Hi,

I'm new to Elastic Search facets. And I'm aware of getting the count
of a field by applying addFacet, but I wonder if there is a
possibility of getting facet count by specifying 2 fields( I mean AND
operator in Facet).

For example,

Field1 Field2

1 a
1 b
1 a
2 a
2 b

Is it possible to get the results as below,

FacetTerm Count

1,a 2
1,b 1
2,a 1
2,b 1


(system) #3