# Elastic search aggregations buckets counting email format as two different bucket key

**URL:** <https://discuss.elastic.co/t/elastic-search-aggregations-buckets-counting-email-format-as-two-different-bucket-key/23266>\
**Category:** Elasticsearch\
**Created:** [April 16, 2015, 12:15am UTC](https://discuss.elastic.co/t/elastic-search-aggregations-buckets-counting-email-format-as-two-different-bucket-key/23266 "2015-04-16T00:15:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rajesh\_Sindhu](https://avatars.discourse-cdn.com/v4/letter/r/7bcc69/32.png) [@Rajesh\_Sindhu](https://discuss.elastic.co/u/Rajesh_Sindhu)\
**Post date:** [April 16, 2015, 12:15am UTC](https://discuss.elastic.co/t/elastic-search-aggregations-buckets-counting-email-format-as-two-different-bucket-key/23266/1 "2015-04-16T00:15:52Z")

</div>

I have field stored as "user1@user.com " .

Using aggregations json query :

"aggregations": {  
"email-terms": {  
"terms": {  
"field": "l\_obj.email",  
"size": 0,  
"shard\_size": 0,  
"order": {  
"\_count": "desc"  
}  
}  
}  
}

I am getting response :

"buckets" : [  
{  
"key" : "[user.com](http://user.com)",  
"doc\_count" : 1  
},  
{  
"key" : "user1",  
"doc\_count" : 1  
}

instead of

"buckets" : [  
{  
"key" : "user1@user.com",  
"doc\_count" : 1  
}  
]

Same issue persists for string type likes : [user1.user2.user.com](http://user1.user2.user.com) ,I am  
doing terms aggregations . Am i missing something here ?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/c70c288c-f8f2-4239-a8e9-55640c6945e4%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/c70c288c-f8f2-4239-a8e9-55640c6945e4%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Glen\_Smith](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/glen_smith/32/111656_2.png) [@Glen\_Smith](https://discuss.elastic.co/u/Glen_Smith)\
**Post date:** [April 16, 2015, 12:30am UTC](https://discuss.elastic.co/t/elastic-search-aggregations-buckets-counting-email-format-as-two-different-bucket-key/23266/2 "2015-04-16T00:30:10Z")

</div>

There is a bucket for each indexed term for the selected field, not for  
each stored value.

Whatever tokenizer you are using on that field is dividing the text at the  
"@" symbol.

If you want buckets for the exact value of the field, you need a  
not\_analyzed field.

On Wednesday, April 15, 2015 at 8:15:52 PM UTC-4, Rajesh Sindhu wrote:

> I have field stored as "[us...@user.com](mailto:us...@user.com) \<javascript:\> " .
> 
> Using aggregations json query :
> 
> "aggregations": {  
> "email-terms": {  
> "terms": {  
> "field": "l\_obj.email",  
> "size": 0,  
> "shard\_size": 0,  
> "order": {  
> "\_count": "desc"  
> }  
> }  
> }  
> }
> 
> I am getting response :
> 
> "buckets" : [  
> {  
> "key" : "[user.com](http://user.com)",  
> "doc\_count" : 1  
> },  
> {  
> "key" : "user1",  
> "doc\_count" : 1  
> }
> 
> instead of
> 
> "buckets" : [  
> {  
> "key" : "[us...@user.com](mailto:us...@user.com) \<javascript:\>",  
> "doc\_count" : 1  
> }  
> ]
> 
> Same issue persists for string type likes : [user1.user2.user.com](http://user1.user2.user.com) ,I am  
> doing terms aggregations . Am i missing something here ?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/4c3535f6-7fa0-4388-8a81-4ddd26015e92%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/4c3535f6-7fa0-4388-8a81-4ddd26015e92%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 12:19am UTC](https://discuss.elastic.co/t/elastic-search-aggregations-buckets-counting-email-format-as-two-different-bucket-key/23266/3 "2017-07-06T00:19:27Z")

</div>


