# Elasticsearch bucket aggregation

**URL:** <https://discuss.elastic.co/t/elasticsearch-bucket-aggregation/70140>\
**Category:** Elasticsearch\
**Created:** [December 28, 2016, 12:47pm UTC](https://discuss.elastic.co/t/elasticsearch-bucket-aggregation/70140 "2016-12-28T12:47:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![yesu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yesu/32/48857_2.png) [@yesu](https://discuss.elastic.co/u/yesu)\
**Post date:** [December 28, 2016, 12:47pm UTC](https://discuss.elastic.co/t/elasticsearch-bucket-aggregation/70140/1 "2016-12-28T12:47:33Z")

</div>

Would anybody suggest to get aggregation response as below, bucket aggregation values should be word wise rather than phrase.

Ex dataset on which aggregation query is being run:

{"skill": "3+ years of experience on java"}  
{"skill": "3+ years of experience on java"}  
{"skill": "java"}

Current response:  
{  
"took": 10,  
"timed\_out": false,  
"\_shards": {  
"total": 3,  
"successful": 3,  
"failed": 0  
},  
"hits": {  
"total": 6098,  
"max\_score": 0,  
"hits": []  
},  
"aggregations": {  
"aggs": {  
"doc\_count\_error\_upper\_bound": 0,  
"sum\_other\_doc\_count": 0,  
"buckets": [  
{  
"key": "3+ years of experience on java",  
"doc\_count": 2  
},  
{  
"key": "java",  
"doc\_count": 1  
}  
]  
}  
}  
}

Expecting response :

{  
"took": 10,  
"timed\_out": false,  
"\_shards": {  
"total": 3,  
"successful": 3,  
"failed": 0  
},  
"hits": {  
"total": 6098,  
"max\_score": 0,  
"hits": []  
},  
"aggregations": {  
"aggs": {  
"doc\_count\_error\_upper\_bound": 0,  
"sum\_other\_doc\_count": 0,  
"buckets": [  
{  
"key": "java",  
"doc\_count": 3  
}  
]  
}  
}  
}

---

<div class="post-metadata">

**Author:** ![ywelsch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ywelsch/32/7751_2.png) [@ywelsch](https://discuss.elastic.co/u/ywelsch)\
**Post date:** [December 28, 2016, 12:56pm UTC](https://discuss.elastic.co/t/elasticsearch-bucket-aggregation/70140/2 "2016-12-28T12:56:42Z")

</div>

"skill" needs to be an analyzed field for this to work at the word level.

---

<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:** [January 25, 2017, 12:56pm UTC](https://discuss.elastic.co/t/elasticsearch-bucket-aggregation/70140/3 "2017-01-25T12:56:49Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
