Java API for setting compression on _source

I read the section here on compressing the source field:
http://www.elasticsearch.org/guide/reference/mapping/source-field.html

Is there a Java API that will allow me to set the "compress" value on the
_source field to true?

Thanks,
Raj

Hi Raj,

There is no dedicated method for this in the api as far as I know. If
you want to use the compress option from the Java api then it looks
like this:
String mapping =
XContentFactory.jsonBuilder().startObject().startObject("type1")
.startObject("_source").field("compress", compress).endObject()
.endObject().endObject().string();

client.admin().indices().preparePutMapping().setType("type1").setSource(mapping).execute().actionGet();

Martijn

On 1 August 2012 00:11, re92 rajawesome@gmail.com wrote:

I read the section here on compressing the source field:
Elasticsearch Platform — Find real-time answers at scale | Elastic

Is there a Java API that will allow me to set the "compress" value on the
_source field to true?

Thanks,
Raj

--
Met vriendelijke groet,

Martijn van Groningen

Thanks Martin. I set it up with curl for now, but will follow your steps in
Java.

Raj

On Wednesday, August 1, 2012 9:09:58 AM UTC-4, Martijn v Groningen wrote:

Hi Raj,

There is no dedicated method for this in the api as far as I know. If
you want to use the compress option from the Java api then it looks
like this:
String mapping =
XContentFactory.jsonBuilder().startObject().startObject("type1")
.startObject("_source").field("compress",
compress).endObject()
.endObject().endObject().string();

client.admin().indices().preparePutMapping().setType("type1").setSource(mapping).execute().actionGet();

Martijn

On 1 August 2012 00:11, re92 rajawesome@gmail.com wrote:

I read the section here on compressing the source field:
Elasticsearch Platform — Find real-time answers at scale | Elastic

Is there a Java API that will allow me to set the "compress" value on
the
_source field to true?

Thanks,
Raj

--
Met vriendelijke groet,

Martijn van Groningen