Unique/Distinct values from elasticsearch query


(soumya sengupta) #1

How to get unique or distinct values from elastic search query ?
I want to get all the unique vales and not their total count.

--
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/00a45aff-6d67-40ae-8c54-e00481011bce%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(aash dhariya) #2

You could use facet query to get all the unique values for a particular
field. Though you will get the counts too.

On Wed, Feb 19, 2014 at 3:21 PM, soumya sengupta
maverick.soumya@gmail.comwrote:

How to get unique or distinct values from elastic search query ?
I want to get all the unique vales and not their total count.

--
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/00a45aff-6d67-40ae-8c54-e00481011bce%40googlegroups.com
.
For more options, visit https://groups.google.com/groups/opt_out.

--
Thanks,
Aash

--
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/CAG7ZG_c9dFktpJ%2BucLQpmQp-oYqssKhBc9bfg%3D%2B-DA3vEK_4YA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(soumya sengupta) #3

I have got an ngram-analyzer for the field which is preventing me from
using facets.
What options do I have ?

On Wednesday, February 19, 2014 4:36:13 PM UTC+5:30, geeky_sh wrote:

You could use facet query to get all the unique values for a particular
field. Though you will get the counts too.

On Wed, Feb 19, 2014 at 3:21 PM, soumya sengupta <maveric...@gmail.com<javascript:>

wrote:

How to get unique or distinct values from elastic search query ?
I want to get all the unique vales and not their total count.

--
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/00a45aff-6d67-40ae-8c54-e00481011bce%40googlegroups.com
.
For more options, visit https://groups.google.com/groups/opt_out.

--
Thanks,
Aash

--
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/d798c2f3-c460-45f1-a83a-fcb5180f40c9%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(aash dhariya) #4

You can set the type of the field as multi_field. For example:

"value" : {
"type" : "multi_field",
"fields" : {
"value" : {
"type" : "string",
"analyzer" : "custom_ngram_analyzer"
},
"value_untouched" : {
"type" : "string",
"index" : "not_analyzed",
}
}
}

Now, you can compute the facets for value.value_untouched and for search
you can simple use value.

To learn more about multi_field, you can visit:

http://www.elasticsearch.org/guide/en/elasticsearch/reference/0.90/mapping-multi-field-type.html

On Wed, Feb 19, 2014 at 5:02 PM, soumya sengupta
maverick.soumya@gmail.comwrote:

I have got an ngram-analyzer for the field which is preventing me from
using facets.
What options do I have ?

On Wednesday, February 19, 2014 4:36:13 PM UTC+5:30, geeky_sh wrote:

You could use facet query to get all the unique values for a particular
field. Though you will get the counts too.

On Wed, Feb 19, 2014 at 3:21 PM, soumya sengupta maveric...@gmail.comwrote:

How to get unique or distinct values from elastic search query ?
I want to get all the unique vales and not their total count.

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

To view this discussion on the web visit https://groups.google.com/d/
msgid/elasticsearch/00a45aff-6d67-40ae-8c54-e00481011bce%
40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
Thanks,
Aash

--
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/d798c2f3-c460-45f1-a83a-fcb5180f40c9%40googlegroups.com
.

For more options, visit https://groups.google.com/groups/opt_out.

--
Thanks,
Aash

--
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/CAG7ZG_fgm2DV1paXe_OiH7fcKPe0M3bYA8Jr7VMHqxiqZFtmNA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(soumya sengupta) #5

Thanks, that worked

On Wed, Feb 19, 2014 at 5:41 PM, aash dhariya aash.discover@gmail.comwrote:

You can set the type of the field as multi_field. For example:

"value" : {
"type" : "multi_field",
"fields" : {
"value" : {
"type" : "string",
"analyzer" : "custom_ngram_analyzer"
},
"value_untouched" : {
"type" : "string",
"index" : "not_analyzed",
}
}
}

Now, you can compute the facets for value.value_untouched and for search
you can simple use value.

To learn more about multi_field, you can visit:

http://www.elasticsearch.org/guide/en/elasticsearch/reference/0.90/mapping-multi-field-type.html

On Wed, Feb 19, 2014 at 5:02 PM, soumya sengupta <
maverick.soumya@gmail.com> wrote:

I have got an ngram-analyzer for the field which is preventing me from
using facets.
What options do I have ?

On Wednesday, February 19, 2014 4:36:13 PM UTC+5:30, geeky_sh wrote:

You could use facet query to get all the unique values for a particular
field. Though you will get the counts too.

On Wed, Feb 19, 2014 at 3:21 PM, soumya sengupta maveric...@gmail.comwrote:

How to get unique or distinct values from elastic search query ?
I want to get all the unique vales and not their total count.

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

To view this discussion on the web visit https://groups.google.com/d/
msgid/elasticsearch/00a45aff-6d67-40ae-8c54-e00481011bce%
40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
Thanks,
Aash

--
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/d798c2f3-c460-45f1-a83a-fcb5180f40c9%40googlegroups.com
.

For more options, visit https://groups.google.com/groups/opt_out.

--
Thanks,
Aash

--
You received this message because you are subscribed to a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elasticsearch/VL0Zn9kXzbk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/CAG7ZG_fgm2DV1paXe_OiH7fcKPe0M3bYA8Jr7VMHqxiqZFtmNA%40mail.gmail.com
.

For more options, visit https://groups.google.com/groups/opt_out.

--
Soumya Sen Gupta

--
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/CAOzQMVQt%2Ba6gq73Y35nunP7MKGTj3EEB1%2B%3Dfpirg5c%2BAxDpxMg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(jigish thakar) #6

Hey Soumya,
I needed exactly same in my implementation. and hardly 2 days old with
ElasticSearch.

Can you please post code snippet you used in mapping and then to fetch
unique values?

Thanks in advance.

On Thursday, February 20, 2014 12:39:08 PM UTC+5:30, soumya sengupta wrote:

Thanks, that worked

On Wed, Feb 19, 2014 at 5:41 PM, aash dhariya <aash.d...@gmail.com
<javascript:>> wrote:

You can set the type of the field as multi_field. For example:

"value" : {
"type" : "multi_field",
"fields" : {
"value" : {
"type" : "string",
"analyzer" : "custom_ngram_analyzer"
},
"value_untouched" : {
"type" : "string",
"index" : "not_analyzed",
}
}
}

Now, you can compute the facets for value.value_untouched and for search
you can simple use value.

To learn more about multi_field, you can visit:

http://www.elasticsearch.org/guide/en/elasticsearch/reference/0.90/mapping-multi-field-type.html

On Wed, Feb 19, 2014 at 5:02 PM, soumya sengupta <maveric...@gmail.com
<javascript:>> wrote:

I have got an ngram-analyzer for the field which is preventing me from
using facets.
What options do I have ?

On Wednesday, February 19, 2014 4:36:13 PM UTC+5:30, geeky_sh wrote:

You could use facet query to get all the unique values for a particular
field. Though you will get the counts too.

On Wed, Feb 19, 2014 at 3:21 PM, soumya sengupta maveric...@gmail.com
wrote:

How to get unique or distinct values from elastic search query ?
I want to get all the unique vales and not their total count.

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

To view this discussion on the web visit https://groups.google.com/d/
msgid/elasticsearch/00a45aff-6d67-40ae-8c54-e00481011bce%
40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
Thanks,
Aash

--
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/d798c2f3-c460-45f1-a83a-fcb5180f40c9%40googlegroups.com
.

For more options, visit https://groups.google.com/groups/opt_out.

--
Thanks,
Aash

--
You received this message because you are subscribed to a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elasticsearch/VL0Zn9kXzbk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/CAG7ZG_fgm2DV1paXe_OiH7fcKPe0M3bYA8Jr7VMHqxiqZFtmNA%40mail.gmail.com
.

For more options, visit https://groups.google.com/groups/opt_out.

--
Soumya Sen Gupta

--
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/acb62c3d-00d7-4f7a-9b3e-08d64aeb82bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #7