Dynamic mapping of types excluded from custom mapping

Hello ES experts!

I'm busy defining custom mappings on my data, and I had a couple of questions!

I'm defining how to analyze fields for specified types in my mapping, and I don't want to explicitly specify a mapping for all fields, or all types, because our data-set is huge. I'd only like to override functionality for certain fields we're doing autocomplete and search for.

The fields and types not specified in my custom mapping should be dynamically mapped and inserted. We'd like to be able to query for analytics occasionally.

So here are some questions:

  • By specifying a custom mapping, does this disable all dynamic mapping, effectively disabling data storage of fields I haven't explicitly mapped?
  • If I try to index a document for a type that I haven't explicitly defined in my mapping, will the insertion work? What about for a sub-field or property of a type that I haven't defined in my mapping?

Thanks for any help and/or information! I've had trouble finding out about the default behavior and how ES rejects or accepts insertions as a result. I believe asking this question here in a concise way will help shortcut users in the future if they have similar questions.

I'm using ES 5.5

-Jeff

Hi @Jeffrey_Blayney,

By default, Elasticsearch will not disable dynamic mapping in unmapped fields. You can define some fields and after create more dynamic fields. This behaviour also applies to different types and sub-fields.

To change this behaviour you should explicitly declare dynamic: false|stric in your mapping:
https://www.elastic.co/guide/en/elasticsearch/reference/current/dynamic.html

Cheers,
LG

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.