Disable dynamic mapping for index except for 1 field

I want to index documents where same fields can have different data types. My documents look like this:

{
	"user": "testuser",
	"field1": "arbitraryDataTypeValue",
	"field2": "arbitraryDataTypeValue"

    ...n fields...
}

Therefore I can disable the mapping like this:

PUT myIndex
{
  "mappings": {
    "default": {
          "enabled": false
    }
  }
}

The drawback is, that the fields cannot be searched.

My problem is, that I have only one field "user", that should be searchable and I do not want to disable all other fields explicitly one by one.

Is there a way to disable the mapping of all fields except for one?

Something like this:

PUT myIndex
{
	"mappings": {
		"default": {
			"enabled": false,
			"properties": {
				"user": {
					"enabled": true
				}
			}
		}
	}
}

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