Created
December 22, 2022 16:42
-
-
Save stefnestor/3e428f621cbcf43e7b4ada2b3e855f82 to your computer and use it in GitHub Desktop.
Override Index Field's Mapping Data Type
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Runtime: https://www.elastic.co/guide/en/elasticsearch/reference/8.5/runtime-mapping-fields.html | |
DELETE test_index | |
PUT test_index | |
{ "mappings": { "properties": { "myKey": { "type": "text" }}}} | |
POST test_index/_doc | |
{ "myKey": "myValue" } | |
GET test_index/_mapping | |
# { | |
# "test_index": { | |
# "mappings": { | |
# "properties": { | |
# "myKey": { | |
# "type": "text" | |
# } | |
# } | |
# } | |
# } | |
# } | |
GET test_index/_field_caps?fields=myKey | |
# { | |
# "indices": [ | |
# "test_index" | |
# ], | |
# "fields": { | |
# "myKey": { | |
# "keyword": { | |
# "type": "keyword", | |
# "metadata_field": false, | |
# "searchable": true, | |
# "aggregatable": true | |
# } | |
# } | |
# } | |
# } | |
PUT test_index/_mapping | |
{ "runtime": { "myKey": { "type": "keyword" }}} | |
GET test_index/_mapping | |
# { | |
# "test_index": { | |
# "mappings": { | |
# "runtime": { | |
# "myKey": { | |
# "type": "keyword" | |
# } | |
# }, | |
# "properties": { | |
# "myKey": { | |
# "type": "text" | |
# } | |
# } | |
# } | |
# } | |
# } | |
GET test_index/_field_caps?fields=myKey | |
# { | |
# "indices": [ | |
# "test_index" | |
# ], | |
# "fields": { | |
# "myKey": { | |
# "keyword": { | |
# "type": "keyword", | |
# "metadata_field": false, | |
# "searchable": true, | |
# "aggregatable": true | |
# } | |
# } | |
# } | |
# } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment