SoFunction
Updated on 2024-10-29

The implementation of elasticsearch inserting and updating data in Python

First, my index structure is saucy.

    

Stores an index with name_id as the primary key for the data to be inserted or updated as:

     

There will generally be there are two operations:

The following image is a personal opinion, I haven't tried to see if it will run directly, but the form is correct.

The data does not exist and I need to insert the address as an empty string.

Single-stripe insertion:


Batch Insert:


This data exists and I need to update the address field to an empty string.

Single-article updates:


Batch update:


summarize

The above is a small introduction to the implementation of Python in elasticsearch insertion and update data, I hope to help you, if you have any questions welcome to leave me a message, I will reply to you in a timely manner!