# Faceted results from delmited string

**URL:** <https://discuss.elastic.co/t/faceted-results-from-delmited-string/17306>\
**Category:** Elasticsearch\
**Created:** [May 1, 2014, 7:56pm UTC](https://discuss.elastic.co/t/faceted-results-from-delmited-string/17306 "2014-05-01T19:56:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eric\_Sims](https://avatars.discourse-cdn.com/v4/letter/e/3be4f8/32.png) [@Eric\_Sims](https://discuss.elastic.co/u/Eric_Sims)\
**Post date:** [May 1, 2014, 7:56pm UTC](https://discuss.elastic.co/t/faceted-results-from-delmited-string/17306/1 "2014-05-01T19:56:23Z")

</div>

so i've got some data in a field (originally from my sql db) that is a  
delimited string.

in the example of music. i've got a field of genres associated to an album.

a document may look something like : 'genres': 'Rock | Pop | Alternative'.

i want to get a faceted result with those values being split up.

something like:

"facets": {  
"tags": {  
"\_type": "terms",  
"missing": 841,  
"total": 159,  
"other": 3,  
"terms": [  
{  
"term": "Rock",  
"count": 89  
},  
{  
"term": " Pop,  
"count": 42  
},  
{  
"term": " Alternative",  
"count": 16  
},  
]  
}  
}

--  
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/f665bd3c-5546-4029-939c-09e7d60d2286%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/f665bd3c-5546-4029-939c-09e7d60d2286%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [May 1, 2014, 8:25pm UTC](https://discuss.elastic.co/t/faceted-results-from-delmited-string/17306/2 "2014-05-01T20:25:10Z")

</div>

Hi Eric,

Wouldn't it be easier to do this on client-side and to provide  
Elasticsearch with the tags in an array?

Otherwise, you should be able to achieve this behavior thanks to the patter  
tokenizer[1].

[1]

> **[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.

On Thu, May 1, 2014 at 9:56 PM, Eric Sims [eric.sims.aent.com@gmail.com](mailto:eric.sims.aent.com@gmail.com)wrote:

> so i've got some data in a field (originally from my sql db) that is a  
> delimited string.
> 
> in the example of music. i've got a field of genres associated to an album.
> 
> a document may look something like : 'genres': 'Rock | Pop | Alternative'.
> 
> i want to get a faceted result with those values being split up.
> 
> something like:
> 
> "facets": {  
> "tags": {  
> "\_type": "terms",  
> "missing": 841,  
> "total": 159,  
> "other": 3,  
> "terms": [  
> {  
> "term": "Rock",  
> "count": 89  
> },  
> {  
> "term": " Pop,  
> "count": 42  
> },  
> {  
> "term": " Alternative",  
> "count": 16  
> },  
> ]  
> }  
> }
> 
> --  
> 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/f665bd3c-5546-4029-939c-09e7d60d2286%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/f665bd3c-5546-4029-939c-09e7d60d2286%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/f665bd3c-5546-4029-939c-09e7d60d2286%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/f665bd3c-5546-4029-939c-09e7d60d2286%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
Adrien Grand

--  
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/CAL6Z4j6bzzASXhtgFhBiKNmmo4gR2\_ppV\_OHsH8L7ZTKyXL1WA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j6bzzASXhtgFhBiKNmmo4gR2_ppV_OHsH8L7ZTKyXL1WA%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Eric\_Sims](https://avatars.discourse-cdn.com/v4/letter/e/3be4f8/32.png) [@Eric\_Sims](https://discuss.elastic.co/u/Eric_Sims)\
**Post date:** [May 1, 2014, 8:45pm UTC](https://discuss.elastic.co/t/faceted-results-from-delmited-string/17306/3 "2014-05-01T20:45:52Z")

</div>

i like where you are going with that. however, at least initially, i am  
using jdbc-river to get my data from sql into elasticsearch. i'm unclear on  
how i would create that array from a column in my sql db.

On Thursday, May 1, 2014 4:25:10 PM UTC-4, Adrien Grand wrote:

> Hi Eric,
> 
> Wouldn't it be easier to do this on client-side and to provide  
> Elasticsearch with the tags in an array?
> 
> Otherwise, you should be able to achieve this behavior thanks to the  
> patter tokenizer[1].
> 
> [1]  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/analysis-pattern-tokenizer.html)
> 
> On Thu, May 1, 2014 at 9:56 PM, Eric Sims \<[eric.sims...@gmail.com](mailto:eric.sims...@gmail.com)\<javascript:\>
> 
> > wrote:
> 
> > so i've got some data in a field (originally from my sql db) that is a  
> > delimited string.
> > 
> > in the example of music. i've got a field of genres associated to an  
> > album.
> > 
> > a document may look something like : 'genres': 'Rock | Pop | Alternative'.
> > 
> > i want to get a faceted result with those values being split up.
> > 
> > something like:
> > 
> > "facets": {  
> > "tags": {  
> > "\_type": "terms",  
> > "missing": 841,  
> > "total": 159,  
> > "other": 3,  
> > "terms": [  
> > {  
> > "term": "Rock",  
> > "count": 89  
> > },  
> > {  
> > "term": " Pop,  
> > "count": 42  
> > },  
> > {  
> > "term": " Alternative",  
> > "count": 16  
> > },  
> > ]  
> > }  
> > }
> > 
> > --  
> > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/f665bd3c-5546-4029-939c-09e7d60d2286%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/f665bd3c-5546-4029-939c-09e7d60d2286%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/f665bd3c-5546-4029-939c-09e7d60d2286%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/f665bd3c-5546-4029-939c-09e7d60d2286%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> Adrien Grand

--  
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/990c4177-98cb-4dd6-9a65-5f4a08ac8784%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/990c4177-98cb-4dd6-9a65-5f4a08ac8784%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, 1:32am UTC](https://discuss.elastic.co/t/faceted-results-from-delmited-string/17306/4 "2017-07-06T01:32:14Z")

</div>


