ES 1.0.0 Source filtering using the Java API


(Dan Tuffery) #1

I'm migrating to 1.0.0 and a few of my queries are broken because I am
using the 'fields' parameter. I understand I need to use source filtering
as per the link below but his there support for source filtering using the
Java AP yetI?

http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/search-request-source-filtering.html

--
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/b65acf48-c13d-4d64-ad4b-a95aa47b89c9%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Binh Ly-2) #2

Yes you can use the client.setFetchSource() method:

  SearchResponse response = client.prepareSearch("index")
    .setFetchSource(new String[] {"field1", "field2"}, null)
    .execute()
    .actionGet();

--
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/0de2a992-2397-476d-8a96-345026b60aae%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Dan Tuffery) #3

Thanks for your response.I can't see the method 'setFetchSource' in the
Client class. Are you sure that is in 1.0.0?

On Tuesday, February 25, 2014 8:41:37 PM UTC, Binh Ly wrote:

Yes you can use the client.setFetchSource() method:

  SearchResponse response = client.prepareSearch("index")
    .setFetchSource(new String[] {"field1", "field2"}, null)
    .execute()
    .actionGet();

--
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/d9b1aa0b-80f8-49a8-9f50-5e54db05562c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Binh Ly-2) #4

Hmmm, can please double-check. I can see it from the tests here:

--
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/a0676082-5638-4f16-b5b7-76fb42ac2a5e%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Dan Tuffery) #5

Yes, I can see it. Thanks.

On 25 Feb 2014, at 22:23, Binh Ly binhly_es@yahoo.com wrote:

Hmmm, can please double-check. I can see it from the tests here:

https://github.com/elasticsearch/elasticsearch/blob/v1.0.0/src/test/java/org/elasticsearch/search/source/SourceFetchingTests.java

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/a0676082-5638-4f16-b5b7-76fb42ac2a5e%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
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/9E1DEA66-32A9-4AFC-B0EB-C5507A72B266%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #6