Skip to content

Instantly share code, notes, and snippets.

@TomonoriSoejima
Created November 21, 2022 02:03
Show Gist options
  • Save TomonoriSoejima/1fe7cc44fad73774bf32ca0d7521d645 to your computer and use it in GitHub Desktop.
Save TomonoriSoejima/1fe7cc44fad73774bf32ca0d7521d645 to your computer and use it in GitHub Desktop.
dynamic_templates_test.md
DELETE my-index-00000*
PUT my-index-000001
{
  "mappings": {
    "dynamic_templates": [
      {
        "integers": {
          "match_mapping_type": "long",
          "mapping": {
            "type": "integer"
          }
        }
      },
      {
        "strings": {
          "match_mapping_type": "string",
          "mapping": {
            "type": "text",
            "fields": {
              "raw": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          }
        }
      }
    ],
    "properties": {
      "ip_addr": {
        "type": "ip"
      }
    }
  }
}


PUT my-index-000002
{
  "mappings": {
    "dynamic_templates": [
      {
        "integers": {
          "match_mapping_type": "long",
          "mapping": {
            "type": "integer"
          }
        }
      },
      {
        "strings": {
          "match_mapping_type": "string",
          "mapping": {
            "type": "text",
            "fields": {
              "raw": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          }
        }
      }
    ]
  }
}


PUT my-index-000001/_doc/1
{
  "ip_addr": "192.168.1.1"
}
GET  my-index-000001/_mapping


PUT my-index-000002/_doc/1
{
  "ip_addr": "192.168.1.1"
}

GET  my-index-000002/_mapping

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