View on GitHub

Tips

Set a default template

Elasticsearch by default analyzed all string fields. This template is usefull since it add a new field field.facet. This fields isn't tokenized.

PUT _template/default_curiosity
{
  "template": "*",
  "settings": {
    "index": {
      "analysis": {
        "analyzer": {
          "tag_analyzer": {
            "filter": [
              "asciifolding",
              "lowercase"
            ],
            "tokenizer": "keyword"
          },
          "custom_french_analyzer": {
            "filter": [
              "asciifolding",
              "lowercase",
              "elision"
            ],
            "tokenizer": "standard"
          }
        },
        "filter": {
          "elision": {
            "type" : "elision",
            "articles": [
              "d",
              "j",
              "l",
              "m",
              "n",
              "t",
              "qu",
              "n",
              "s",
              "c"
            ]
          }
        }
      }
    }
  },
  "mappings": {
    "_default_": {
      "dynamic_templates": [
        {
          "facet_template": {
            "mapping": {
              "type": "multi_field",
              "fields": {
                "facet": {
                  "index": "analyzed",
                  "analyzer": "tag_analyzer",
                  "type": "string"
                },
                "{name}": {
                  "index": "analyzed",
                  "analyzer": "custom_french_analyzer",
                  "type": "string"
                }
              }
            },
            "match_mapping_type": "string",
            "match": "*"
          }
        }
      ]
    }
  },
  "aliases": {}
}