Adding a field to the default mapping

I am having trouble adding a field (named user.privateAttributes) to an existing _default_ mapping. Instead of adding the new field, it is replacing the entire mapping with a new single-field mapping.

When I run the same call on a regular mapping (for a type, not _default_), the field is added as I expect, with other fields remaining untouched.

I'm running ES 2.4.1.

My request to add the field is like this:

curl -s -XPUT http://localhost:9200/users/_mapping/_default_ -d'
  {
      "properties": {
          "user": {
              "properties": {
                  "privateAttributes": {
                      "type": "string",
                      "fields": {
                          "untouched": {
                              "type": "string",
                              "index": "not_analyzed"
                          }
                      }
                  }
              }
          }
      }
  }'

How can I modify the default mapping to add a new field, leaving the existing fields unchanged?

Ahh, I see that in later versions of the documentation, this note is added:

When updating the default mapping with the PUT mapping API, the new mapping is not merged with the existing mapping. Instead, the new default mapping replaces the existing one.

I guess this limitation was in 2.4 as well, but just not called out in the docs.

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