setup:
  - requires:
      test_runner_features: [ capabilities ]
      capabilities:
        - method: PUT
          path: /{index}
          capabilities: [ logsdb_index_mode ]
      reason: "Support for 'logsdb' index mode capability required"

---
synthetic_source_keep defaults:
  - do:
      indices.create:
        index: test1
        body:
          settings:
            index:
              mode: logsdb

  - do:
      indices.create:
        index: test2

  - do:
      indices.get_settings:
        index: test1
        include_defaults: true

  - is_true: test1
  - match: { test1.settings.index.mode: "logsdb" }
  - match: { test1.defaults.index.mapping.synthetic_source_keep: "arrays" }

  - do:
      indices.get_settings:
        index: test2
        include_defaults: true

  - is_true: test2
  - is_false: test2.settings.index.mode
  - match: { test2.defaults.index.mapping.synthetic_source_keep: "none" }

---
total_fields.ignore_dynamic_beyond_limit defaults:
  - do:
      indices.put_index_template:
        name: template-foo
        body:
          index_patterns: ["ds-foo*"]
          data_stream: {}
          priority: 700
          template:
            settings:
              index.mode: logsdb

  - do:
      indices.create_data_stream:
        name: ds-foo

  - do:
      indices.get_data_stream:
        name: ds-foo
  - set: { data_streams.0.indices.0.index_name: backing_index }

  - do:
      indices.get_settings:
        index: ds-foo
        include_defaults: true
  - match: { .$backing_index.defaults.index.mapping.total_fields.ignore_dynamic_beyond_limit: "true" }

  - do:
      indices.get_settings:
        index: ds-foo
        name: index.mapping.total_fields.ignore_dynamic_beyond_limit
        include_defaults: true
  - match: { .$backing_index.defaults.index.mapping.total_fields.ignore_dynamic_beyond_limit: "true" }
