# How to get Facet for two field concatenation

**URL:** <https://discuss.elastic.co/t/how-to-get-facet-for-two-field-concatenation/7014>\
**Category:** Elasticsearch\
**Created:** [March 15, 2012, 11:00am UTC](https://discuss.elastic.co/t/how-to-get-facet-for-two-field-concatenation/7014 "2012-03-15T11:00:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vibin](https://avatars.discourse-cdn.com/v4/letter/v/2bfe46/32.png) [@vibin](https://discuss.elastic.co/u/vibin)\
**Post date:** [March 15, 2012, 11:00am UTC](https://discuss.elastic.co/t/how-to-get-facet-for-two-field-concatenation/7014/1 "2012-03-15T11:00:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [March 16, 2012, 7:17pm UTC](https://discuss.elastic.co/t/how-to-get-facet-for-two-field-concatenation/7014/2 "2012-03-16T19:17:36Z")

</div>

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

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

Term Scripts will give you more control/flexibility.

--  
Ivan

On Thu, Mar 15, 2012 at 4:00 AM, vibin dhas [vibindhas@gmail.com](mailto: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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 3:35am UTC](https://discuss.elastic.co/t/how-to-get-facet-for-two-field-concatenation/7014/3 "2017-07-06T03:35:50Z")

</div>


