定义索引模板

2020-06-24  本文已影响0人  秦汉邮侠

题目

代码示例

PUT _template/template_1
{
  "index_patterns": [
    "te*",
    "bar*"
  ],
  "settings": {
    "analysis": {
      "filter": {
        "synonym": {
          "type": "synonym",
          "lenient": true,
          "synonyms": [
            "oa,oA,OA,onse"
          ]
        },
        "english_stop": {
          "type": "stop",
          "stopwords": "_english_"
        },
        "english_keywords": {
          "type": "keyword_marker",
          "keywords": [
            "example"
          ]
        },
        "english_stemmer": {
          "type": "stemmer",
          "language": "english"
        },
        "english_possessive_stemmer": {
          "type": "stemmer",
          "language": "possessive_english"
        }
      },
      "analyzer": {
        "rebuilt_english": {
          "tokenizer": "standard",
          "filter": [
            "synonym",
            "english_possessive_stemmer",
            "lowercase",
            "english_stop",
            "english_keywords",
            "english_stemmer"
          ]
        }
      }
    }
  },
  "mappings": {
    "dynamic": "strict", 
    "properties": {
      "foo": {
        "type": "text",
        "analyzer": "rebuilt_english"
      },
      "created_at": {
        "type": "date",
        "format": "strict_date_time"
      }
    }
  }
}

索引模板

上一篇下一篇

猜你喜欢

热点阅读