Skip to content

添加文档


addDocument()

根据索引添加文档,需要传入两个参数。EDb() 可以传入一个数据源的名称,默认是第一个数据源

  • @param index 索引
  • @param body 结构 (index: string, body: DBOBJECT)

addDocument()

EDb().addDocument('goods', {
  settings: {
    number_of_shards: 1,
    number_of_replicas: 1
  },
  mappings: {
    properties: {
      field1: { type: "text" },
      field2: { type: "keyword" },
      field3: { type: "integer" }
    }
  }
})
EDb().addDocument('goods', {
  settings: {
    number_of_shards: 1,
    number_of_replicas: 1
  },
  mappings: {
    properties: {
      field1: { type: "text" },
      field2: { type: "keyword" },
      field3: { type: "integer" }
    }
  }
})

备案号:冀ICP备20015584号-2