Python Forum
bulk update in elasticsearch
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
bulk update in elasticsearch
#1
I am trying to update bulk document to elasticsearch

I am able to update this one by one document

following code works

  
elastic_output = Elasticsearch(output_master, http_auth=(elastic_user, elastic_password), port=9200)

 data_to_update = {
   "doc" : {
   "job": job_rec['job'],
   "site" : job_rec['site'],
   }
  }

elastic_output.update(index="my_index-2020",doc_type='_doc',id=data_to_update['doc']['job'],body=data_to_update)
how do I create bulk json and use bulk update?
Reply
#2
I created list something like this by reading data from mongo.
where I am intested in updating record with new value called site


{'_op_type': 'update', '_index': 'my_index-2020', '_id': 314800814, 'doc_as_upsert': True, 'doc': {'job': 314800814, 'site': 'hill'}}
{'_op_type': 'update', '_index': 'my_index-2020', '_id': 314800815, 'doc_as_upsert': True, 'doc': {'job': 314800815, 'site': 'hill'}}

but can't figure out how do I use helper.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Bulk loading of data using python shivamsvmsri 2 612 Sep-28-2023, 09:04 AM
Last Post: shivamsvmsri
  Error while transferring data from sqlite to elasticsearch - please help! ps96068 1 2,629 Jun-12-2021, 09:24 AM
Last Post: ibreeden
  How can I get Python Bulk Email Verification Script With API? zainalee 1 2,460 Jun-06-2021, 09:19 AM
Last Post: snippsat
Question Python + Google Sheet | Best way to update specific cells in a single Update()? Vokofe 1 2,625 Dec-16-2020, 05:26 AM
Last Post: Vokofe
Video Python Bulk Email Verification Script With API Aj1128 0 2,594 Nov-28-2020, 11:38 AM
Last Post: Aj1128
  Bulk add column to dataframe sambanerjee 1 2,093 Sep-24-2020, 07:34 PM
Last Post: sambanerjee
  Unable post request to AWS elasticsearch service Rupini 0 1,865 May-18-2020, 08:27 AM
Last Post: Rupini
  Bulk Generating Cloze Deletions based on Tatoeba sentences and word frequency lists wizzie 10 5,058 Dec-23-2019, 12:16 PM
Last Post: wizzie
  Newbie question for bulk insert into SQL Server database zydjohn 6 12,311 Dec-14-2017, 11:04 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020