博客
关于我
Elasticsearch 索引字段类型为text,添加keyword类型操作
阅读量:803 次
发布时间:2023-01-24

本文共 500 字,大约阅读时间需要 1 分钟。

1. 查看索引类型结构
为了查看索引的类型结构,可以执行以下命令: `GET /my_index/_mapping` 返回结果: ```json { "my_index": { "mappings": { "_meta": {}, "_source": { "includes": [], "excludes": [] }, "numeric_detection": false, "properties": { "my_field": { "type": "text" } } } } } ```
2. 添加Keyword类型
为了添加Keyword类型,可以执行以下 PUT 请求: `PUT /my_index/_mapping` 请求体: ```json { "properties": { "my_field": { "type": "text", "fields": { "keyword": { "type": "keyword", "ignore_above": 256 } } } } } ``` 返回结果: ```json { "acknowledged": true } ```

转载地址:http://jeeyk.baihongyu.com/

你可能感兴趣的文章
python中的keys、values、items
查看>>
Python中的lambda和apply结合使用
查看>>
python中的map函数
查看>>
Python中的numpy模块解析
查看>>
Python中的pickle
查看>>
Python中的signal模块和Ctrl+C操作
查看>>
python中的sort方法
查看>>
Python中的threading
查看>>
python中的urlencode和urldecode
查看>>
python中的with学习
查看>>
python中的write和read的用法,有无换行符
查看>>
Python中的“真“和“假“
查看>>
PYTHON中的主体对象标识
查看>>
Python中的修饰函数始终返回NONE
查看>>
Python中的元素相乘与矩阵相乘(附Demo)
查看>>
Python中的分组/聚类数字
查看>>
python中的十六进制字符串到字节数组
查看>>
Python中的单元测试框架:使用unittest进行有效测试
查看>>
Python中的压缩和解压缩模块:zipfile和tarfile
查看>>
python中的变量可以随时命名、随时赋值_python基础2
查看>>