我正在使用NodeJS Client与集群进行交互。我在映射时遇到麻烦,我想专门将1属性设置为Date并将1属性设置为Boolean。
我尝试了以下代码的各种版本:
// also tried client.putMapping, client.indices.putMapping
await client.index({
index: 'testing',
body: {
"mappings": {
"properties": {
"timeStamp": { type: 'date' }
}
}
}
});
这在我的索引中导致了一个可怕的重复结构(并且Date
类型也被完全忽略了):
{
"mapping": {
"_doc": {
"properties": {
"mappings": {
"properties": {
"properties": {
"properties": {
"timeStamp": {
"properties": {
"type": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
}
}
}
}
}
}
}
}