How to get Facet for two field concatenation

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to get Facet for two field concatenation

vibin
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
Reply | Threaded
Open this post in threaded view
|

Re: How to get Facet for two field concatenation

Ivan Brusic
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 <[hidden email]> 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
Reply | Threaded
Open this post in threaded view
|

Re: How to get Facet for two field concatenation

rpatel18
This post has NOT been accepted by the mailing list yet.
In reply to this post by vibin
facet doesn't exist any more...how do I do it with terms...went to the link but it goes over sizes and buckets which I don't think I need for the above example...