1

だから基本的に新しいことに挑戦しています。今回は弾性検索を使用します。私はすでにエラスティックとキバナ、そしてもちろんセンスプラグインをインストールしています。インデックスの作成、マッピング、ドキュメントの追加などの基本的なコマンドをすべて試します。一括挿入を試みるまではすべてうまくいきます。

POST /ecommerce/product/_bulk
{"index":{"_id":"1002"}}
{"name":"SWA magazine", "price":"90.000", "description":"swa magazine description",
"status":"active", "quantity":3, "categories":[{"name":"magazine"}], 
"tags":["business", "magazine", "sales", "news"]}
{"index":{"_id":"1003"}}
{"name":"SWA magazine", "price":"90.000", "description":"swa magazine description",
"status":"active", "quantity":3, "categories":[{"name":"magazine"}], 
"tags":["business", "magazine", "sales", "news"]}

私は自分のコードの何が問題なのかさえ知りません。私はいつもこのエラーを受け取りました:ここに画像の説明を入力

これを修正するのを手伝ってください。よろしくお願いします。

4

1 に答える 1

2

各ドキュメントは 1 行でなければなりません (つまり、改行を含めてはなりません)。次のように一括クエリを送信します。

POST /ecommerce/product/_bulk
{"index":{"_id":"1002"}}
{"name":"SWA magazine", "price":"90.000", "description":"swa magazine description","status":"active", "quantity":3, "categories":[{"name":"magazine"}], "tags":["business", "magazine", "sales", "news"]}
{"index":{"_id":"1003"}}
{"name":"SWA magazine", "price":"90.000", "description":"swa magazine description", "status":"active", "quantity":3, "categories":[{"name":"magazine"}], "tags":["business", "magazine", "sales", "news"]}

Sense に貼り付けると、1 行目から 9 行目ではなく、1 行目から 5 行目だけになるはずです。

于 2016-06-28T07:17:48.103 に答える