# How i get the value and count of prefix from string

**URL:** <https://discuss.elastic.co/t/how-i-get-the-value-and-count-of-prefix-from-string/17110>\
**Category:** Elasticsearch\
**Created:** [April 21, 2014, 11:44am UTC](https://discuss.elastic.co/t/how-i-get-the-value-and-count-of-prefix-from-string/17110 "2014-04-21T11:44:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sumit\_gupta\_sgt](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@sumit\_gupta\_sgt](https://discuss.elastic.co/u/sumit_gupta_sgt)\
**Post date:** [April 21, 2014, 11:44am UTC](https://discuss.elastic.co/t/how-i-get-the-value-and-count-of-prefix-from-string/17110/1 "2014-04-21T11:44:13Z")

</div>

Hi All,

Suppose I have 5 documents like:

{  
"message": "ab;cd;ef;",  
"message": "ab;gh;jk",  
"message": "sumit;sachin;test",  
"message": "sumit;amit,anuj",  
"message": "sam;brain;new"  
}

Can any buddy suggest me how i can get the value and value for first prefix in string like:

ab: 2  
sumit: 2  
sam: 1

Thanks & Regards,  
Sumit Gupta

---

<div class="post-metadata">

**Author:** ![sumit\_gupta\_sgt](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@sumit\_gupta\_sgt](https://discuss.elastic.co/u/sumit_gupta_sgt)\
**Post date:** [April 21, 2014, 2:31pm UTC](https://discuss.elastic.co/t/how-i-get-the-value-and-count-of-prefix-from-string/17110/2 "2014-04-21T14:31:11Z")

</div>

Solve it using Analyzer.Thanks.

---

<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, 1:34am UTC](https://discuss.elastic.co/t/how-i-get-the-value-and-count-of-prefix-from-string/17110/3 "2017-07-06T01:34:32Z")

</div>

Closed on July 6, 2017, 1:34am UTC


