我正在使用批量 api 创建索引和存储数据字段。我还想设置映射以从源中排除字段“field1”。我知道这可以使用“创建索引 API”参考来完成:https ://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-source-field.html但我使用的是批量 API。以下是示例 API 调用:
POST _bulk
{ "index" : { "_index" : "test", _type = 'testType', "_id" : "1" } }
{ "field1" : "value1" }
有没有办法在批量索引时添加映射设置,类似于下面的代码:
{ "index" : { "_index" : "test", _type = 'testType', "_id" : "1" },
"mappings": {
"_source": {
"excludes": [
"field1"
]
}
}
}
{ "field1" : "value1" }
如何使用批量 API 进行映射?