创建索引
createIndex()
创建索引,需要传入两个参数。EDb()
可以传入一个数据源的名称,默认是第一个数据源
- @param
index
索引 - @param
body
结构 (index: string, body?: DBOBJECT)
createIndex()
EDb().createIndex('goods', {
settings: {
number_of_shards: 1,
number_of_replicas: 1
},
mappings: {
properties: {
field1: { type: "text" },
field2: { type: "keyword" },
field3: { type: "integer" }
}
}
})
EDb().createIndex('goods', {
settings: {
number_of_shards: 1,
number_of_replicas: 1
},
mappings: {
properties: {
field1: { type: "text" },
field2: { type: "keyword" },
field3: { type: "integer" }
}
}
})