小编San*_*man的帖子

elasticsearch:使用javascript创建带映射的索引

我正在尝试使用官方javascript客户端创建一个带有映射的elasticsearch索引.

我的代码如下:

client.indices.create({
    index: "aName",
    "mappings": {
        "aType": {
            "properties": {
                "aProp1": { "type": "string", "index": "not_analyzed" },
                "aProp2": { "type": "string", "index": "not_analyzed" },
                "aProp3": { "type": "string", "index": "not_analyzed" },
                "aProp4": { "type": "string", "index": "not_analyzed" }
            }
        }
    }
}, function(err,resp,respcode){
    console.log(err,resp,respcode);
});
Run Code Online (Sandbox Code Playgroud)

但是...索引已创建但没有映射....输出为:

undefined { ok: true, acknowledged: true } 200

我究竟做错了什么?

javascript elasticsearch

30
推荐指数
4
解决办法
2万
查看次数

标签 统计

elasticsearch ×1

javascript ×1