小编use*_*851的帖子

Elasticsearch Java Api:将字段设置为 _id

我想问一下唯一字段_id是否由文档中的某个字段分配。我看到 Rest,它可以通过path以下方式实现:

{
  "tweet": {
    "_id": {
      "path": "post_id"
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

但是如果我想用java API来做,有什么办法可以实现吗?

Map<String, Object> MapA= new HashMap<String, Object>();
MapA=MapProcessor(MapA);

client.prepareIndex("index","type").setSource(MapA).execute().actionGet();
Run Code Online (Sandbox Code Playgroud)

如何修改我的代码以分配 Map 中的某些字段成为_id这种类型?

elasticsearch elasticsearch-java-api

4
推荐指数
1
解决办法
2474
查看次数

Elasticsearch通过SSH远程访问

关于Elasticsearch HTTP API,我想知道我是否想远程访问SSH服务器上的集群,我应该在http rest命令中包含哪些内容:

    curl -XGET ' http://localhost:9200/ index /_mapping/ type ' 
Run Code Online (Sandbox Code Playgroud)

我尝试了类似下面的东西,但失败了:

    curl -XGET -u cloud-user: --key ~/.ssh/id_rsa --pubkey ~/.ssh/id_rsa.pub  'xx.xxx.xxx.xxx:9200/index/_mapping/type'
Run Code Online (Sandbox Code Playgroud)

有没有人知道正确的命令或替代解决方案?

ssh elasticsearch

1
推荐指数
1
解决办法
4052
查看次数