Elasticsearch 动态添加mapping
生活随笔
收集整理的這篇文章主要介紹了
Elasticsearch 动态添加mapping
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
有時無法確定json中有哪些字段,但可以確定未知字段的type是keyword??梢酝ㄟ^設(shè)置dynamic-templates來實(shí)現(xiàn)。
PUT test {"mappings": {"type": {"properties": {"name": {"type": "keyword"}},"dynamic_templates": [{"strings_as_keywords": {"match_mapping_type": "string","mapping": {"type": "keyword"}}}]}} }添加數(shù)據(jù):
POST test/type {"name": "jack","age": "12","gender": "1" }查看mapping:
{"test": {"mappings": {"type": {"dynamic_templates": [{"strings_as_keywords": {"match_mapping_type": "string","mapping": {"type": "keyword"}}}],"properties": {"age": {"type": "keyword"},"gender": {"type": "keyword"},"name": {"type": "keyword"}}}}} }?
與50位技術(shù)專家面對面20年技術(shù)見證,附贈技術(shù)全景圖總結(jié)
以上是生活随笔為你收集整理的Elasticsearch 动态添加mapping的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Linux Shell脚本编程--jq命
- 下一篇: ubuntu配置dns