Rushi Agrawal ea397e0f92 Add support for Elasticsearch api versioning header
Originally added in Elasticsearch in commit
2c5f1d1569, removed in OpenSearch in
3eac282c57

Note that this just adds support of 'elasticsearch' header, there's no
'opensearch' header support as such.

Signed-off-by: Rushi Agrawal <rushi.agr@gmail.com>
2021-08-28 00:23:46 +05:30
2021-08-19 07:58:20 +05:30
2021-08-19 07:58:20 +05:30
2021-08-13 11:45:36 +05:30
2021-08-10 18:37:42 +05:30
2021-08-26 11:49:50 +05:30
2021-08-19 07:58:20 +05:30
2021-08-19 07:58:20 +05:30
2021-08-19 13:08:26 +05:30
2021-08-19 07:58:20 +05:30
2021-08-20 21:47:30 +03:00
2021-08-13 11:45:36 +05:30

Release CI Integration Chat PRs welcome!

OpenSearch logo

OpenSearch Python Client

Welcome!

opensearch-py is a community-driven, open source fork of elasticsearch-py licensed under the Apache v2.0 License. For more information, see opensearch.org.

This is the low-level client. A high-level Python client is in the works, and will be available soon.

Example use


>>> from datetime import datetime
>>> from opensearch import OpenSearch

# by default we connect to localhost:9200
>>> client = OpenSearch()

# create an index in OpenSearch, ignore status code 400 (index already exists)
>>> client.indices.create(index='my-index', ignore=400)
{'acknowledged': True, 'shards_acknowledged': True, 'index': 'my-index'}

# datetimes will be serialized
>>> client.index(index="my-index", id=42, body={"any": "data", "timestamp": datetime.now()})
{'_index': 'my-index',
    '_type': '_doc',
    '_id': '42',
    '_version': 1,
    'result': 'created',
    '_shards': {'total': 2, 'successful': 1, 'failed': 0},
    '_seq_no': 0,
    '_primary_term': 1}

# but not deserialized
>>> client.get(index="my-index", id=42)['_source']
{'any': 'data', 'timestamp': '2019-05-17T17:28:10.329598'}

Project Resources

Code of Conduct

This project has adopted the Amazon Open Source Code of Conduct. For more information see the Code of Conduct FAQ, or contact opensource-codeofconduct@amazon.com with any additional questions or comments.

License

This project is licensed under the Apache v2.0 License.

Copyright OpenSearch Contributors. See NOTICE for details.

Languages
Python 99.4%
Shell 0.6%