Faceted results from delmited string


(Eric Sims) #1

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/f665bd3c-5546-4029-939c-09e7d60d2286%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Adrien Grand) #2

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]
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.aent.com@gmail.comwrote:

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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/f665bd3c-5546-4029-939c-09e7d60d2286%40googlegroups.comhttps://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.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j6bzzASXhtgFhBiKNmmo4gR2_ppV_OHsH8L7ZTKyXL1WA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(Eric Sims) #3

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]
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<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 <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/f665bd3c-5546-4029-939c-09e7d60d2286%40googlegroups.comhttps://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.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/990c4177-98cb-4dd6-9a65-5f4a08ac8784%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #4