0

Elasticsearch 5.1.1 を使用して、インデックスにドキュメントを一括挿入しています。データベースを更新するには、自動生成された _id とともにドキュメントのフィールドの 1 つを応答で取得する必要があります。

私は次のようなリクエストを試みています:

curl -XPOST localhost:9200/_bulk?pretty -d '
{ "index" : { "_index" : "articles_201701", "_type" : "articles_type" , "_source_include" : "db_id"} }
{ "db_id" : "value1" }
{ "index" : { "_index" : "articles_201701", "_type" : "articles_type" , "_source_include" : "db_id"} }
{ "db_id" : "value2" }
'


curl -XPOST localhost:9200/_bulk?pretty -d '
{ "index" : { "_index" : "articles_201701", "_type" : "articles_type", "fields" : ["db_id"]} }
{ "db_id" : "value1" }
{ "index" : { "_index" : "articles_201701", "_type" : "articles_type", "fields" : ["db_id"]} }
{ "db_id" : "value2" }
'

curl -XPOST 'localhost:9200/_bulk?pretty&fields=db_id' -d '
{ "index" : { "_index" : "articles_201701", "_type" : "articles_type" } }
{ "db_id" : "value1" }
{ "index" : { "_index" : "articles_201701", "_type" : "articles_type"} }
{ "db_id" : "value2" }
' 

わずかなバリエーションと組み合わせがありますが、運が悪いものもあります。

これが可能かどうかはわかりません...

4

1 に答える 1