Using Java, How to retrieve one field from all documents inside an Index

Eg. Index has 100 documents with field A, B, C ....Z

I want to retrieve a list of all A's from the 100 documents in the Index.

--
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/b36f895c-8497-4167-be7b-3227763e6fea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

If it’s « only » 100 docs, you can use .setSize(100) to your search query and .addFields("a"):

client.prepareSearch().setSize(100).addFields("a").get();

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfr https://twitter.com/elasticsearchfr | @scrutmydocs https://twitter.com/scrutmydocs

Le 4 nov. 2014 à 18:57, Ap usc90909@gmail.com a écrit :

Eg. Index has 100 documents with field A, B, C ....Z

I want to retrieve a list of all A's from the 100 documents in the Index.

--
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/b36f895c-8497-4167-be7b-3227763e6fea%40googlegroups.com https://groups.google.com/d/msgid/elasticsearch/b36f895c-8497-4167-be7b-3227763e6fea%40googlegroups.com?utm_medium=email&utm_source=footer.
For more options, visit https://groups.google.com/d/optout https://groups.google.com/d/optout.

--
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/66A869B8-E43D-49E8-B890-38BC2ED66FBF%40pilato.fr.
For more options, visit https://groups.google.com/d/optout.

Hello, David:

I have issue with trying to retrieve all document Ids (or a single field
value of all documents) in an index.
I have about several million documents, but all I need is a list of
document id (sorted if possible), nothing else.
It is taking 5 minutes now for me to get the results. All I need is the
array/list of the Ids.
What would be the fastest and most efficient (no extra data returned) ways
to do this in Java.

Thanks very much

On Tuesday, November 4, 2014 12:57:44 PM UTC-5, Ap wrote:

Eg. Index has 100 documents with field A, B, C ....Z

I want to retrieve a list of all A's from the 100 documents in the Index.

--
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/eb1b4706-2c66-4d8b-8264-f4364757f53e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

So that's not the same story.

You want to do scan and scroll.

See http://www.elasticsearch.org/guide/en/elasticsearch/client/java-api/current/search.html

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 5 nov. 2014 à 13:48, Ted Smith tedsmithgroup@gmail.com a écrit :

Hello, David:

I have issue with trying to retrieve all document Ids (or a single field value of all documents) in an index.
I have about several million documents, but all I need is a list of document id (sorted if possible), nothing else.
It is taking 5 minutes now for me to get the results. All I need is the array/list of the Ids.
What would be the fastest and most efficient (no extra data returned) ways to do this in Java.

Thanks very much

On Tuesday, November 4, 2014 12:57:44 PM UTC-5, Ap wrote:

Eg. Index has 100 documents with field A, B, C ....Z

I want to retrieve a list of all A's from the 100 documents in the Index.

--
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/eb1b4706-2c66-4d8b-8264-f4364757f53e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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/2A15ADB3-340F-4F3A-959B-F72049EA22C9%40pilato.fr.
For more options, visit https://groups.google.com/d/optout.

Thanks. Wish there is simple Java API method to that gives a handle to get
the list in a single call.
Would it be possible to add this feature as it is often needed ( and
supposed to be a simple process)

On the same topic, even with scan and scroll, how can I limit the result
returned only include the id itself,
without all those meta data?

On Wednesday, November 5, 2014 9:10:35 AM UTC-5, David Pilato wrote:

So that's not the same story.

You want to do scan and scroll.

See
http://www.elasticsearch.org/guide/en/elasticsearch/client/java-api/current/search.html

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 5 nov. 2014 à 13:48, Ted Smith <tedsmi...@gmail.com <javascript:>> a
écrit :

Hello, David:

I have issue with trying to retrieve all document Ids (or a single field
value of all documents) in an index.
I have about several million documents, but all I need is a list of
document id (sorted if possible), nothing else.
It is taking 5 minutes now for me to get the results. All I need is the
array/list of the Ids.
What would be the fastest and most efficient (no extra data returned) ways
to do this in Java.

Thanks very much

On Tuesday, November 4, 2014 12:57:44 PM UTC-5, Ap wrote:

Eg. Index has 100 documents with field A, B, C ....Z

I want to retrieve a list of all A's from the 100 documents in the Index.

--
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/eb1b4706-2c66-4d8b-8264-f4364757f53e%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/eb1b4706-2c66-4d8b-8264-f4364757f53e%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
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/d9d9c5af-11cf-435f-9496-9c783b3f67f9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

addFields("_id") should work I think though all metadata will be sent but _source.

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 6 nov. 2014 à 05:23, Ted Smith tedsmithgroup@gmail.com a écrit :

Thanks. Wish there is simple Java API method to that gives a handle to get the list in a single call.
Would it be possible to add this feature as it is often needed ( and supposed to be a simple process)

On the same topic, even with scan and scroll, how can I limit the result returned only include the id itself,
without all those meta data?

On Wednesday, November 5, 2014 9:10:35 AM UTC-5, David Pilato wrote:
So that's not the same story.

You want to do scan and scroll.

See http://www.elasticsearch.org/guide/en/elasticsearch/client/java-api/current/search.html

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 5 nov. 2014 à 13:48, Ted Smith tedsmi...@gmail.com a écrit :

Hello, David:

I have issue with trying to retrieve all document Ids (or a single field value of all documents) in an index.
I have about several million documents, but all I need is a list of document id (sorted if possible), nothing else.
It is taking 5 minutes now for me to get the results. All I need is the array/list of the Ids.
What would be the fastest and most efficient (no extra data returned) ways to do this in Java.

Thanks very much

On Tuesday, November 4, 2014 12:57:44 PM UTC-5, Ap wrote:

Eg. Index has 100 documents with field A, B, C ....Z

I want to retrieve a list of all A's from the 100 documents in the Index.

--
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/eb1b4706-2c66-4d8b-8264-f4364757f53e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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/d9d9c5af-11cf-435f-9496-9c783b3f67f9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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/9D2875A8-2445-4A8B-8C44-7F82836D39D6%40pilato.fr.
For more options, visit https://groups.google.com/d/optout.