更新时间:2024-09-14 GMT+08:00
CSS服务中Elasticsearch 7.x集群如何在index下创建type?
在Elasticsearch 7.x版本中,去掉了type概念,在7.x及以后的版本中,index都不再支持创建type。
如果需要强制使用,可以在命令中添加“include_type_name=true”强制使用type类型,且只支持单type。
PUT index?include_type_name=true
{
"mappings": {
"my_type": {
"properties": {
"@timestamp": {
"type": "date"
}
}
}
}
}
多type索引创建完成之后,可以执行如下命令写入数据。
PUT index/my_type/1
{
"@timestamp":"2019-02-20"
}
父主题: CSS集群搜索引擎使用