From 77f6338ef2842dc8b5976a0ea3e6a2a8f53fa79b Mon Sep 17 00:00:00 2001 From: Keith Rozario <795867+keithrozario@users.noreply.github.com> Date: Sun, 14 Jul 2024 10:52:50 +0800 Subject: [PATCH] Update guides-bulk example Fixed examples to make them working python code. (missing commas and quotes. Signed-off-by: Keith Rozario <795867+keithrozario@users.noreply.github.com> --- guides/bulk.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/guides/bulk.md b/guides/bulk.md index 2f0c13f1..545834a1 100644 --- a/guides/bulk.md +++ b/guides/bulk.md @@ -37,11 +37,11 @@ The client can also serialize an array of data into bulk-delimited JSON for you. ```python data = [ - { "index": { "_index": "index-2022-06-08", "_id": 1 }} - { "name": "foo"} - { "index": { "_index": "index-2022-06-09", "_id": 2 }} - { "name": "bar"} - { "index": { "_index": "index-2022-06-10", "_id": 3 }} + { "index": { "_index": "index-2022-06-08", "_id": 1 }}, + { "name": "foo"}, + { "index": { "_index": "index-2022-06-09", "_id": 2 }}, + { "name": "bar"}, + { "index": { "_index": "index-2022-06-10", "_id": 3 }}, { "name": "baz"} ] @@ -64,9 +64,9 @@ from opensearchpy import OpenSearch, helpers client = OpenSearch(...) docs = [ - { "_index": "words", "_id": "word1", word: "foo" }, - { "_index": "words", "_id": "word2", word: "bar" }, - { "_index": "words", "_id": "word3", word: "baz" }, + { "_index": "words", "_id": "word1", "word": "foo" }, + { "_index": "words", "_id": "word2", "word": "bar" }, + { "_index": "words", "_id": "word3", "word": "baz" }, ] response = helpers.bulk(client, docs, max_retries=3)