Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling multiple mapping type index templates #2356

Closed
Tracked by #1940
dreamer-89 opened this issue Mar 4, 2022 · 3 comments
Closed
Tracked by #1940

Handling multiple mapping type index templates #2356

dreamer-89 opened this issue Mar 4, 2022 · 3 comments

Comments

@dreamer-89
Copy link
Member

dreamer-89 commented Mar 4, 2022

Index templates are preserved over rolling upgrades, so it is possible to multiple type templates in the cluster state. Post removal of mapping types from 2.0; nodes running OpenSearch 2.0 or higher should refuse to join a cluster containing multiple type templates.

@dreamer-89
Copy link
Member Author

dreamer-89 commented Mar 21, 2022

As per discussion with @nknize, we should have tests in place to capture upgrade behavior with multiple type index templates.

The current bwc testing framework limits the previous ES/OS versions against which bwc tests can be run (earliest allowed is 7.10.0 which doesn't support multiple type mappings). So, probably need to start with 5.x version and perform series of upgrades to 2.0.0.

@dreamer-89
Copy link
Member Author

dreamer-89 commented Mar 23, 2022

Discussed it offline with @nknize , who advised to perform manual upgrades and verify if multi-type index templates survive rolling upgrades to 7.x / OS1.x cluster.

Verified that mapping types is removed silently during 6.x -> 7.x upgrade. The template remain same other than type removal under mappings and only one (user in example below) is kept in the template. When an index (test-index) matching template regex is created; it has settings correctly applied from the template. This behavior also applies when cluster upgraded to OS 1.3.0

5.0

curl -X PUT "localhost:9200/_template/template_multi_type?pretty" -H 'Content-Type: application/json' -d'
{
  "template": "te*",
  "settings": {
    "number_of_shards": 1
  },
  "mappings": {
    "tweet": {
      "properties": {
        "message": {
          "type": "keyword"
        }
       }
     },
     "user": {
      "properties": {
        "name": {
          "type": "keyword"
        }
       }
     }
    }
  }
}
'

➜  elasticsearch-5.0.2 curl -X GET "localhost:9200/_template/template_multi_type?pretty"
{
  "template_multi_type" : {
    "order" : 0,
    "template" : "te*",
    "settings" : {
      "index" : {
        "number_of_shards" : "1"
      }
    },
    "mappings" : {
      "user" : {
        "properties" : {
          "name" : {
            "type" : "keyword"
          }
        }
      },
      "tweet" : {
        "properties" : {
          "message" : {
            "type" : "keyword"
          }
        }
      }
    },
    "aliases" : { }
  }
}

7.10.2/7.17

# 7.10/7.17 removes any mapping type info from the index template
➜  ~ curl -X GET "localhost:9200/_template/template_multi_type?pretty"
{
  "template_multi_type" : {
    "order" : 0,
    "index_patterns" : [
      "te*"
    ],
    "settings" : {
      "index" : {
        "number_of_shards" : "1"
      }
    },
    "mappings" : {
      "properties" : {
        "name" : {
          "type" : "keyword"
        }
      }
    },
    "aliases" : { }
  }
}

@dreamer-89
Copy link
Member Author

From manual steps above, it is verified that multi-type templates doesn't persist beyond 6.x. So, it is not possible to have multi-type templates in 7.x+ clusters. Hence, there is no need of handling multi-type templates in OS 2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant