Partially dynamic mappings

Hi there!

We have an elastic mapping that looks something like:

 "mappings": {
            "full-text-content": {
                "dynamic": "strict",
                "properties": {}
                    "doi": {
                        "type": "string",
                        "index": "not_analyzed",
                        "doc_values": True
                    },
                    "customerFacetFields": {
                        "properties": {
                            "field1": {
                                "type": "Boolean",
                                "index": "not_analyzed",
                                "doc_values": True
                            },
                            "field2": {
                                "type": "string",
                                "index": "not_analyzed",
                                "doc_values": True
                            },
                            "field3": {
                                "type": "string",
                                "index": "not_analyzed",
                                "doc_values": True
                            }
                        }
                    },
                    "customerPassthroughFields": {
                        "properties": {
                            "passthroughfield1": {
                                "type": "string"
                            },
                            "passthroughfield2": {
                                "type": "string"
                            }
                        }
                    }
                }
            }
        } 

As you call tell:

  • We use strict mode
  • There are 2 types of fields determined by the customer, depending on if it's something we want to support facetting on or not

To enable this, we've built a kind of self-service, that allows customers to define new fields (with limitations).

However, for the passthroughFields, this is seen as a bit too much bother - really, we want them to be able to put whatever they want in there, and schema be damned. On the other hand, we really don't want them to mess with the schema of customerFacetFields.

Is there any way to tell Elastic to make the whole schema "strict" BUT allow a sub-part ("customerPassthroughFields") to be dynamic?

Thanks in advance!

Nope :frowning:

I guess if you enforce a mapping for the customer facet fields, Elastic will enforce that particular schema and types of those fields, but would still accept other fields in the index. Not sure if that is the case in strict-mode as well, but should get your job done.

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