Elasticsearch template confusion

I'm new to elasticsearch and have fond some strange behaviour, at least in my opinion.

The thing is that I created the index template in the first code example below, and then inserted the test document in the second code example.
When I then open kibana and view the json document I get the result from the third code example. Even on the fields that uses lowercase filter the value shown is the original value and not the lowercase value.

Anyone know why or can point me in the right direction?

I also would value if someone could explain to me how I can inspect the values stored in elasticsearch for all applied analyzers for a single document in an index. This to verify that all is working as expected.

PUT _index_template/des
{
	"index_patterns": [
		"des*"
	],
	"priority": 600,
	"template": {
		"settings": {
			"index": {
				"max_ngram_diff": 7
			},
			"analysis": {
				"analyzer": {
					"lowercase_analyzer": {
						"filter": [
							"lowercase"
						],
						"tokenizer": "keyword"
					},
					"ngram_analyzer": {
						"filter": [
							"lowercase"
						],
						"tokenizer": "ngram_tokenizer"
					}
				},
				"tokenizer": {
					"ngram_tokenizer": {
						"type": "ngram",
						"min_gram": "1",
						"max_gram": "8"
					}
				}
			}
		},
		"mappings": {
			"dynamic_templates": [
				{
					"strings": {
						"match_mapping_type": "string",
						"mapping": {
							"type": "text",
							"fields": {
								"raw": {
									"type": "keyword",
									"ignore_above": 256
								},
								"lowercase": {
									"type": "text",
									"analyzer": "lowercase_analyzer"
								},
								"ngram": {
									"type": "text",
									"analyzer": "ngram_analyzer"
								}
							}
						}
					}
				}
			]
		}
	}
}

POST des-1/_doc
{
  "tt": "This is the test"

}
{
  "_index": "des-1",
  "_id": "AmCXFY4BYRFx4Rf5Jkda",
  "_version": 1,
  "_score": 0,
  "_source": {
    "tt": "This is the test"
  },
  "fields": {
    "tt": [
      "This is the test"
    ],
    "tt.raw": [
      "This is the test"
    ],
    "tt.lowercase": [
      "This is the test"
    ],
    "tt.ngram": [
      "This is the test"
    ]
  }
}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.