2013-03-14 10 views

risposta

16

Sì, è possibile!

provata su 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

Si può fornire l'esempio di API Java per la stessa operazione da copione ? –

+0

Grazie, @dadoonet. È possibile aggiornare più documenti senza specificare un ID? – Harshit

+0

Non con l'API di massa. L'aggiornamento per query può essere ciò che desideri. – dadoonet

1

Ecco un altro esempio di caricamento collettivo senza specificare il _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 

`

di risposta è inferiore

`

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

`

Problemi correlati