2013-03-14 7 views

答えて

16

はい、できます。 0.90.0.Beta1でテスト

:ここ

$ cat requests 
{ "index" : { "_index" : "test", "_type" : "type1" } } 
{ "field1" : "value1" } 

$ curl -s -XPOST localhost:9200/_bulk --data-binary @requests; echo 
{"took":6,"items":[{"create":{"_index":"test","_type":"type1","_id":"IWqsRqyhRVq-F69OLIngTA","_version":1,"ok":true}}]} 
+0

を下回っています? –

+0

ありがとう、@ dadoonet。 IDを指定せずに複数のドキュメントを更新することは可能ですか? – Harshit

+0

バルクAPIではありません。クエリによる更新が必要な場合があります。 – dadoonet

1

は_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 

`

応答は、スクリプトによって同じ操作のために、サンプルのJava APIを提供してくださいすることができ

`

{ 
    "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 
     } 
    } 
    ] 
} 

`

関連する問題