_all and Java API


(Ben Dotte) #1

Hi,

Is there a way to specify which fields to include/exclude from _all using
just the Java API? I'm currently indexing data using XContentBuilder (do
not have separate json mappings) like this:

XContentBuilder builder = jsonBuilder().startObject()
.field("datefield", new Date())
.field("astring", "blah")
.endObject();

I would like to exclude things like dates, numeric fields, etc. Is it
necessary to create json mappings to have this fine-grained of control?

Thanks,
Ben

--
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/8bd090af-bfa1-4794-9ea6-852691bc63d0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(David Pilato) #2

Yes. You need to define a mapping.

My recommandation would to disable _all field and use copy_to feature which is to me really more flexible.

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr

Le 25 juin 2014 à 17:51:59, Ben Dotte (bdotte@widen.com) a écrit:

Hi,

Is there a way to specify which fields to include/exclude from _all using just the Java API? I'm currently indexing data using XContentBuilder (do not have separate json mappings) like this:

XContentBuilder builder = jsonBuilder().startObject()
.field("datefield", new Date())
.field("astring", "blah")
.endObject();

I would like to exclude things like dates, numeric fields, etc. Is it necessary to create json mappings to have this fine-grained of control?

Thanks,
Ben

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/8bd090af-bfa1-4794-9ea6-852691bc63d0%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/etPan.53aaf0b5.440badfc.9da9%40MacBook-Air-de-David.local.
For more options, visit https://groups.google.com/d/optout.


(system) #3