Define required fields in the mapping

Is it possible to define required fields in the mapping, so an attempt to
index a document that's missing the fields would throw an error?

--
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.

ElasticSearch can be prevented from automatically creating an index and
automatically indexing unknown fields by updating the elasticsearch.ymlfile as follows:

action.auto_create_index: false
index.mapper.dynamic: false

The ability to disable automatic index creation and dynamic mapping is in
ElasticSearch versions 0.20.X and later.

Brian

On Tuesday, August 6, 2013 9:14:09 AM UTC-4, Kristi wrote:

Is it possible to define required fields in the mapping, so an attempt to
index a document that's missing the fields would throw an error?

--
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.

Almost forget: With this, you'll need to explicitly create an index with
the mappings you need, along with whatever filters those mappings require.

Brian

On Tuesday, August 6, 2013 10:11:12 AM UTC-4, InquiringMind wrote:

ElasticSearch can be prevented from automatically creating an index and
automatically indexing unknown fields by updating the elasticsearch.ymlfile as follows:

action.auto_create_index: false
index.mapper.dynamic: false

The ability to disable automatic index creation and dynamic mapping is in
ElasticSearch versions 0.20.X and later.

Brian

On Tuesday, August 6, 2013 9:14:09 AM UTC-4, Kristi wrote:

Is it possible to define required fields in the mapping, so an attempt to
index a document that's missing the fields would throw an error?

--
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 for your response. However, I don't think this does what I
want. It's fine if unknown fields are automatically indexed, I don't want
to prevent that. I was wondering if it's possible to define in the mapping
that some fields are required. For example, you define a field called
"title", and you want all documents that are indexed to have the "title"
field. Is it possible to configure ElasticSearch to validate that this
field is in the document when you index it, and throw an error if it is
missing?

I think in Solr, you can just add required="true" to the schema.xml when
you define the fields for a type. Is there a way to do this in
ElasticSearch?

On Tuesday, August 6, 2013 2:13:00 PM UTC, InquiringMind wrote:

Almost forget: With this, you'll need to explicitly create an index with
the mappings you need, along with whatever filters those mappings require.

Brian

On Tuesday, August 6, 2013 10:11:12 AM UTC-4, InquiringMind wrote:

ElasticSearch can be prevented from automatically creating an index and
automatically indexing unknown fields by updating the elasticsearch.ymlfile as follows:

action.auto_create_index: false
index.mapper.dynamic: false

The ability to disable automatic index creation and dynamic mapping is in
ElasticSearch versions 0.20.X and later.

Brian

On Tuesday, August 6, 2013 9:14:09 AM UTC-4, Kristi wrote:

Is it possible to define required fields in the mapping, so an attempt
to index a document that's missing the fields would throw an error?

--
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.