19

ドキュメント ID を指定せずに一括インデックスを作成することはできますか? インデックス作成中に Elasticsearch にランダム ID を生成してもらいたいのですが、それは可能ですか?

4

2 に答える 2

3

_id を指定しない一括アップロードの別の例を次に示します。

`

curl -XPOST "http://localhost:9200/_bulk" -d'
    { "index" : { "_index" : "test", "_type" : "demo" } }
    { "title" : "Quick brown rabbits", "content" : "Brown rabbits are commonly seen" }
    { "index" : { "_index" : "test", "_type" : "demo" } }
    { "title" : "Keeping pets healthy", "content" : "My quick brown fox eats rabbits

`

レスポンスは以下

`

{
  "took": 451,
  "errors": false,
  "items": [
    {
      "create": {
        "_index": "test",
        "_type": "demo",
        "_id": "AVYDtp_fxosF2Bdj7ghV",
        "_version": 1,
        "_shards": {
          "total": 2,
          "successful": 1,
          "failed": 0
        },
        "status": 201
      }
    },
    {
      "create": {
        "_index": "test",
        "_type": "demo",
        "_id": "AVYDtp_fxosF2Bdj7ghW",
        "_version": 1,
        "_shards": {
          "total": 2,
          "successful": 1,
          "failed": 0
        },
        "status": 201
      }
    }
  ]
}

`

于 2016-07-19T15:24:23.320 に答える