Getting all the distinct values of a field


(ElasticUsers) #1

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


(Karussell) #2

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 kranti_...@rediffmail.com 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.


(Ivan Brusic) #3

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

On Thu, Jan 19, 2012 at 1:40 AM, Karussell tableyourtime@googlemail.com 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 kranti_...@rediffmail.com 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.


(Patricia Narvasa) #4

Hi all just want to ask if what if the unique values that im currently querying distinct values on ES has special characters.

example:

"user090@sample.com"

it doesn't get the exact value, it gets the count separately for user090, sample, com


(system) #5