Getting all the distinct values of a field

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Getting all the distinct values of a field

ElasticUsers
Hi Team,

One of our use cases is to get all the distinct values of a particular field. For e. g. if we are querying against Oracle database we can execute below query :

select distinct column_name from table_name

The above query gives us all the distinct values of column 'column_name' from the table 'table_name'.

We need something similar in Elastic Search. Please provide inputs on how this can be achieved in Elastic Search Java API.

Thanks..
Reply | Threaded
Open this post in threaded view
|

Re: Getting all the distinct values of a field

Karussell
If the column_name is indexed with a keyword analyzer then you can
facet over that field:

http://www.elasticsearch.org/guide/reference/api/search/facets/index.html

Peter.

On 19 Jan., 09:13, ElasticUsers <[hidden email]> wrote:

> Hi Team,
>
> One of our use cases is to get all the distinct values of a particular
> field. For e. g. if we are querying against Oracle database we can execute
> below query :
>
> select distinct column_name from table_name
>
> The above query gives us all the distinct values of column 'column_name'
> from the table 'table_name'.
>
> We need something similar in Elastic Search. Please provide inputs on how
> this can be achieved in Elastic Search Java API.
>
> Thanks..
>
> --
> View this message in context:http://elasticsearch-users.115913.n3.nabble.com/Getting-all-the-disti...
> Sent from the ElasticSearch Users mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: Getting all the distinct values of a field

Ivan Brusic
There was a discussion about this functionality not too long ago and
an issue was opened:

https://github.com/elasticsearch/elasticsearch/issues/1530


On Thu, Jan 19, 2012 at 1:40 AM, Karussell <[hidden email]> wrote:

> If the column_name is indexed with a keyword analyzer then you can
> facet over that field:
>
> http://www.elasticsearch.org/guide/reference/api/search/facets/index.html
>
> Peter.
>
> On 19 Jan., 09:13, ElasticUsers <[hidden email]> wrote:
>> Hi Team,
>>
>> One of our use cases is to get all the distinct values of a particular
>> field. For e. g. if we are querying against Oracle database we can execute
>> below query :
>>
>> select distinct column_name from table_name
>>
>> The above query gives us all the distinct values of column 'column_name'
>> from the table 'table_name'.
>>
>> We need something similar in Elastic Search. Please provide inputs on how
>> this can be achieved in Elastic Search Java API.
>>
>> Thanks..
>>
>> --
>> View this message in context:http://elasticsearch-users.115913.n3.nabble.com/Getting-all-the-disti...
>> Sent from the ElasticSearch Users mailing list archive at Nabble.com.