Turn source store to false while using Java API

Hi,

I have just started using elasticsearch to enable searching through our
logs. However, I do not want to store the source in due to store overheads.

How can I set the _source enabled to false using the Java API.

Appreciate any help.

Thanks,

gc

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Use PutMapping API.

PutMappingResponse response = client.admin().indices()
.preparePutMapping(index)
.setType(type)
.setSource(source).execute().actionGet();

In source, put a String or use XContentBuilder that produce
{
"tweet" : {
"_source" : {"enabled" : false}
}
}
HTH

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

Le 28 juin 2013 à 01:02, gc gitansh@gmail.com a écrit :

Hi,

I have just started using elasticsearch to enable searching through our logs. However, I do not want to store the source in due to store overheads.

How can I set the _source enabled to false using the Java API.

Appreciate any help.

Thanks,

gc

--
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.
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.
For more options, visit https://groups.google.com/groups/opt_out.

Thank you David.

I tried to do this using the API and it get a successful response.

However, when I check the mapping it does not take effect.
I tried using command line and same result.

Eg:
curl -XPUT 'http://localhost:9200/abc/xyz/_mapping' -d '
{
"xyz" : {
"_source" : {"enabled" : false}
}
}
'
{"ok":true,"acknowledged":true}

And when I query the mapping:
{"abc":{"xyz":{"properties":{"channel":{"type":"string"},"customer":{"type":"string"},"message":{"type":"string"},"startDate":{"type":"string"}}}}}

Is there anything I need to run after I change the mapping?

On Thursday, June 27, 2013 8:12:03 PM UTC-7, David Pilato wrote:

Use PutMapping API.

  		PutMappingResponse response = client.admin().indices() 

.preparePutMapping(index)
.setType(type)

.setSource(source).execute().actionGet();

In source, put a String or use XContentBuilder that produce

{
"tweet" : {
"_source" : {"enabled" : false}
}
}

HTH

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

Le 28 juin 2013 à 01:02, gc <git...@gmail.com <javascript:>> a écrit :

Hi,

I have just started using elasticsearch to enable searching through our
logs. However, I do not want to store the source in due to store overheads.

How can I set the _source enabled to false using the Java API.

Appreciate any help.

Thanks,

gc

--
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:>.
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.
For more options, visit https://groups.google.com/groups/opt_out.

You can't change some properties on existing mapping.
You need to delete it before (it will remove all docs) and then create it again.

It looks strange to me that you did not get an error here.

HTH

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

Le 28 juin 2013 à 21:10, gc gitansh@gmail.com a écrit :

Thank you David.

I tried to do this using the API and it get a successful response.

However, when I check the mapping it does not take effect.
I tried using command line and same result.

Eg:
curl -XPUT 'http://localhost:9200/abc/xyz/_mapping' -d '
{
"xyz" : {
"_source" : {"enabled" : false}
}
}
'
{"ok":true,"acknowledged":true}

And when I query the mapping:
{"abc":{"xyz":{"properties":{"channel":{"type":"string"},"customer":{"type":"string"},"message":{"type":"string"},"startDate":{"type":"string"}}}}}

Is there anything I need to run after I change the mapping?

On Thursday, June 27, 2013 8:12:03 PM UTC-7, David Pilato wrote:

Use PutMapping API.

PutMappingResponse response = client.admin().indices()
.preparePutMapping(index)
.setType(type)
.setSource(source).execute().actionGet();

In source, put a String or use XContentBuilder that produce
{
"tweet" : {
"_source" : {"enabled" : false}
}
}
HTH

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

Le 28 juin 2013 à 01:02, gc git...@gmail.com a écrit :

Hi,

I have just started using elasticsearch to enable searching through our logs. However, I do not want to store the source in due to store overheads.

How can I set the _source enabled to false using the Java API.

Appreciate any help.

Thanks,

gc

--
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.
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.
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.
For more options, visit https://groups.google.com/groups/opt_out.