<commit_before>---
"PUT mapping with typeless API on an index that has types":

 - do:
      indices.create: # not using include_type_name: false on purpose
          include_type_name: true
          index: index
          body:
              mappings:
                  not_doc:
                      properties:
                          foo:
                              type: "keyword"

 - do:
      indices.put_mapping:
          include_type_name: false
          index: index
          body:
              properties:
                  bar:
                      type: "long"

 - do:
      indices.get_mapping:
          include_type_name: false
          index: index

 - match: { index.mappings.properties.foo.type: "keyword" }
 - match: { index.mappings.properties.bar.type: "long" }

 - do:
      indices.put_mapping:
          include_type_name: false
          index: index
          body:
              properties:
                  foo:
                      type: "keyword" # also test no-op updates that trigger special logic wrt the mapping version

 - do:
      catch: /the final mapping would have more than 1 type/
      indices.put_mapping:
          include_type_name: true
          index: index
          type: some_other_type
          body:
              some_other_type:
                  properties:
                      bar:
                          type: "long"


---
"PUT mapping with _doc on an index that has types":

 - skip:
      version: "all"
      reason: include_type_name is only supported as of 6.7 # AwaitsFix: https://github.com/elastic/elasticsearch/issues/38202


 - do:
      indices.create:
          include_type_name: true
          index: index
          body:
              mappings:
                  my_type:
                      properties:
                          foo:
                              type: "keyword"

 - do:
      catch: /the final mapping would have more than 1 type/
      indices.put_mapping:
          include_type_name: true
          index: index
          type: _doc
          body:
              _doc:
                  properties:
                      bar:
                          type: "long"<commit_msg>Reenable test in `indices.put_mapping/20_mix_typeless_typeful.yml`. (#39056)<commit_after>---
"PUT mapping with typeless API on an index that has types":

 - do:
      indices.create: # not using include_type_name: false on purpose
          include_type_name: true
          index: index
          body:
              mappings:
                  not_doc:
                      properties:
                          foo:
                              type: "keyword"

 - do:
      indices.put_mapping:
          include_type_name: false
          index: index
          body:
              properties:
                  bar:
                      type: "long"

 - do:
      indices.get_mapping:
          include_type_name: false
          index: index

 - match: { index.mappings.properties.foo.type: "keyword" }
 - match: { index.mappings.properties.bar.type: "long" }

 - do:
      indices.put_mapping:
          include_type_name: false
          index: index
          body:
              properties:
                  foo:
                      type: "keyword" # also test no-op updates that trigger special logic wrt the mapping version

 - do:
      catch: /the final mapping would have more than 1 type/
      indices.put_mapping:
          include_type_name: true
          index: index
          type: some_other_type
          body:
              some_other_type:
                  properties:
                      bar:
                          type: "long"


---
"PUT mapping with _doc on an index that has types":

 - skip:
      version: " - 6.6.99"
      reason: include_type_name is only supported as of 6.7


 - do:
      indices.create:
          include_type_name: true
          index: index
          body:
              mappings:
                  my_type:
                      properties:
                          foo:
                              type: "keyword"

 - do:
      catch: /the final mapping would have more than 1 type/
      indices.put_mapping:
          include_type_name: true
          index: index
          type: _doc
          body:
              _doc:
                  properties:
                      bar:
                          type: "long"
{'fraction_non_alphanumeric': 0.06873008648156577, 'fraction_numerical': 0.005461993627674101, 'mean_word_length': 1.1544117647058822, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5457062', 'n_tokens_mistral': 1146, 'n_tokens_neox': 1079, 'n_words': 323}