Skip to main content

Connect to ES and write documents with two modes: append and overwrite!

Project description

Using to insert/update ES document

To build and upload to pypi, run two commands

python bdist_wheel

python -m twine upload dist/

How to use

create es connection
import elasticwriter
from elasticwriter.elasticwriter import *

es = get_es([

create index if not exsited with mapping and setting

	mapping = {
           "_doc": { 
               "properties": {
                   "name": {
                        "type": "text",

    index_name = 'tuan-test'
    create_index_if_not_existed(es, index_name, mapping)

handle with dataframe

test_df = spark.createDataFrame([(1, 'tuan', 30), (2, 'tank', 27)], ['es_id', 'name', 'age'])

push_df_to_index(es, index_name, test_df, 'overwrite')

handle with list dictionary

test_list = [
    {'es_id': 3, 'name': 'tuyet', 'age': 25}
push_list_dict_to_index(es, index_name, test_list, 'overwrite')

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for elasticwriter, version 2.2.1
Filename, size File type Python version Upload date Hashes
Filename, size elasticwriter-2.2.1-py3-none-any.whl (3.1 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page