# \#opensearch-py

**URL:** https://forum.opensearch.org/tag/opensearch-py/2.md

[Latest](https://forum.opensearch.org/latest.md) · [Categories](https://forum.opensearch.org/categories.md) · [Tags](https://forum.opensearch.org/tags.md)

---

## [How to deploy a Hugging Face model that requires trust\_remote\_code=True](https://forum.opensearch.org/t/how-to-deploy-a-hugging-face-model-that-requires-trust-remote-code-true/19242)

<div class="topic-metadata">

**Author:** [@malv007](https://forum.opensearch.org/u/malv007)\
**Replies:** 0\
**Last updated:** [May 7, 2024, 2:51pm UTC](https://forum.opensearch.org/t/how-to-deploy-a-hugging-face-model-that-requires-trust-remote-code-true/19242 "2024-05-07T14:51:43Z")

</div>

Versions (relevant - OpenSearch/Dashboard/Server OS/Browser): 2.13 Describe the issue: We have followed this tutorial to deploy different Hugging Face models to OpenSearch without problems: Demo tracing model torchsc…

---

## [What does "OpenSearch.indices.create" refer to?](https://forum.opensearch.org/t/what-does-opensearch-indices-create-refer-to/17666)

<div class="topic-metadata">

**Author:** [@roy649](https://forum.opensearch.org/u/roy649)\
**Replies:** 1\
**Last updated:** [February 1, 2024, 2:02pm UTC](https://forum.opensearch.org/t/what-does-opensearch-indices-create-refer-to/17666 "2024-02-01T14:02:09Z")

</div>

Under API Reference / helpers / index , it refers to OpenSearch.indices, ie: Any additional keyword arguments will be passed to OpenSearch.indices.create unchanged. It’s not clear what “OpenSearch.indices” means. Th…

---

## [How to include "missing" values in aggregations](https://forum.opensearch.org/t/how-to-include-missing-values-in-aggregations/17576)

<div class="topic-metadata">

**Author:** [@tlacuache](https://forum.opensearch.org/u/tlacuache)\
**Replies:** 2\
**Last updated:** [January 24, 2024, 11:35pm UTC](https://forum.opensearch.org/t/how-to-include-missing-values-in-aggregations/17576 "2024-01-24T23:35:44Z")

</div>

Versions (relevant - OpenSearch/Dashboard/Server OS/Browser): OpenSearch 2.11.1 opensearch-py 2.4.2 Describe the issue: This should be pretty simple to answer I think but I am not doing well at figuring out the docum…

---

## [uWSGI Worker Crashes on Frequent OpenSearch Requests via opensearch\_dsl](https://forum.opensearch.org/t/uwsgi-worker-crashes-on-frequent-opensearch-requests-via-opensearch-dsl/17390)

<div class="topic-metadata">

**Author:** [@zaalgol](https://forum.opensearch.org/u/zaalgol)\
**Replies:** 0\
**Last updated:** [January 10, 2024, 2:47pm UTC](https://forum.opensearch.org/t/uwsgi-worker-crashes-on-frequent-opensearch-requests-via-opensearch-dsl/17390 "2024-01-10T14:47:10Z")

</div>

Versions (relevant - OpenSearch/Dashboard/Server OS/Browser): opensearch-dsl 2.1.0 opensearch-py 2.3.0 Describe the issue: I am running a Python Flask server in a uWSGI workers. The uWSGI crushes wh…

---

## [Python API documentation seems to be empty](https://forum.opensearch.org/t/python-api-documentation-seems-to-be-empty/16420)

<div class="topic-metadata">

**Author:** [@rain](https://forum.opensearch.org/u/rain)\
**Replies:** 3\
**Last updated:** [November 16, 2023, 3:28pm UTC](https://forum.opensearch.org/t/python-api-documentation-seems-to-be-empty/16420 "2023-11-16T15:28:06Z")

</div>

I got the link of python client API documentation, but seems like it’s empty, https://opensearch-project.github.io/opensearch-py/api-ref/clients/opensearch\_client.html Where could I find detailed API documentation of o…

---

## [401, AuthenticationException while connecting to OpenSearch using opensearch-py basic authentication](https://forum.opensearch.org/t/401-authenticationexception-while-connecting-to-opensearch-using-opensearch-py-basic-authentication/15845)

<div class="topic-metadata">

**Author:** [@rizwan\_kn](https://forum.opensearch.org/u/rizwan_kn)\
**Replies:** 0\
**Last updated:** [September 11, 2023, 12:00pm UTC](https://forum.opensearch.org/t/401-authenticationexception-while-connecting-to-opensearch-using-opensearch-py-basic-authentication/15845 "2023-09-11T12:00:07Z")

</div>

Hi, I have an AWS Lambda function written in python which uses opensearch-py==2.2.0 I am able to successfully connect to my OpenSearch cluster, check if an index exists and create an index through the below code, Cod…

---

## [Snapshot client documentation confusion](https://forum.opensearch.org/t/snapshot-client-documentation-confusion/14448)

<div class="topic-metadata">

**Author:** [@sdhoyt](https://forum.opensearch.org/u/sdhoyt)\
**Replies:** 4\
**Last updated:** [June 6, 2023, 5:49pm UTC](https://forum.opensearch.org/t/snapshot-client-documentation-confusion/14448 "2023-06-06T17:49:08Z")

</div>

Versions (relevant - OpenSearch/Dashboard/Server OS/Browser): opensearch-py version 2.2.0 python version 3.9.2 Debian GNU/Linux 11 (bullseye) Describe the issue: I’m struggling to understand how to use the Snapshot …

---

## [Deleting Index causes Timeout value connect was 600, but it must be an int, float or None](https://forum.opensearch.org/t/deleting-index-causes-timeout-value-connect-was-600-but-it-must-be-an-int-float-or-none/13803)

<div class="topic-metadata">

**Author:** [@vasiachr](https://forum.opensearch.org/u/vasiachr)\
**Replies:** 7\
**Last updated:** [April 7, 2023, 7:49pm UTC](https://forum.opensearch.org/t/deleting-index-causes-timeout-value-connect-was-600-but-it-must-be-an-int-float-or-none/13803 "2023-04-07T19:49:45Z")

</div>

Versions (relevant - OpenSearch/Dashboard/Server OS/Browser): opensearch-py 2.2.0 Describe the issue: After upgrading from opensearch-py 2.0.0 to 2.2.0 I have been facing the following issue when trying to perform the…

---

## [Python client for train api (when creating a model for knn indexing)](https://forum.opensearch.org/t/python-client-for-train-api-when-creating-a-model-for-knn-indexing/12508)

<div class="topic-metadata">

**Author:** [@rocket](https://forum.opensearch.org/u/rocket)\
**Replies:** 1\
**Last updated:** [February 20, 2023, 9:54pm UTC](https://forum.opensearch.org/t/python-client-for-train-api-when-creating-a-model-for-knn-indexing/12508 "2023-02-20T21:54:53Z")

</div>

Versions (relevant - OpenSearch/Dashboard/Server OS/Browser): opensearch 1.0 opensearch-py 2.1.1 Describe the issue: I’m trying to call the train API (this) in order to generate a model for knn-based indexing using f…

---

## [Request Error in opensearch-py OpenSearch client exists(), create(), index()... methods](https://forum.opensearch.org/t/request-error-in-opensearch-py-opensearch-client-exists-create-index-methods/11561)

<div class="topic-metadata">

**Author:** [@sdhoyt](https://forum.opensearch.org/u/sdhoyt)\
**Replies:** 2\
**Last updated:** [November 22, 2022, 7:13pm UTC](https://forum.opensearch.org/t/request-error-in-opensearch-py-opensearch-client-exists-create-index-methods/11561 "2022-11-22T19:13:40Z")

</div>

Versions (relevant - OpenSearch/Dashboard/Server OS/Browser): opensearch-py version 2.0.0 python version 3.9.2 Debian GNU/Linux 11 (bullseye) Describe the issue: When I run OpenSearch client’s exists() function, I g…

---

## [Post API Error- {"status": 400, "body": "Request must contain a osd-xsrf header."}](https://forum.opensearch.org/t/post-api-error-status-400-body-request-must-contain-a-osd-xsrf-header/10886)

<div class="topic-metadata">

**Author:** [@divyank\_1](https://forum.opensearch.org/u/divyank_1)\
**Replies:** 1\
**Last updated:** [September 12, 2022, 3:25pm UTC](https://forum.opensearch.org/t/post-api-error-status-400-body-request-must-contain-a-osd-xsrf-header/10886 "2022-09-12T15:25:05Z")

</div>

Hi, I am using python client library to send post request. Below is my code, when I send post reuest without osd-xsrf header, getting error - {"status": 400, "body": "Request must contain a osd-xsrf header."}. While…

---

## [Bulk operation using Python](https://forum.opensearch.org/t/bulk-operation-using-python/9887)

<div class="topic-metadata">

**Author:** [@wolverine](https://forum.opensearch.org/u/wolverine)\
**Replies:** 1\
**Last updated:** [August 3, 2022, 9:51am UTC](https://forum.opensearch.org/t/bulk-operation-using-python/9887 "2022-08-03T09:51:55Z")

</div>

Hi, I found documentation lack example how to use bulk OpenSearch api. I examples from ElasticSearch bulk api. I want to confirm if I am doing this correctly. I am using these parameters for the request. This is how t…

---

## [How to add GEOIP when using OpenSearch python client to upload log](https://forum.opensearch.org/t/how-to-add-geoip-when-using-opensearch-python-client-to-upload-log/10414)

<div class="topic-metadata">

**Author:** [@beilei](https://forum.opensearch.org/u/beilei)\
**Replies:** 0\
**Last updated:** [July 28, 2022, 2:21pm UTC](https://forum.opensearch.org/t/how-to-add-geoip-when-using-opensearch-python-client-to-upload-log/10414 "2022-07-28T14:21:37Z")

</div>

Hello everyone, I’m really struggling trying to add geoip into my data. I am using python client to upload the log. I have a dataset includes src\_ip and dst\_ip, I want them to be geoip then I can use the dashboard to v…

---

## [Learn how to write OpenSearch queries with Python 🐍](https://forum.opensearch.org/t/learn-how-to-write-opensearch-queries-with-python/10409)

<div class="topic-metadata">

**Author:** [@laysauchoa](https://forum.opensearch.org/u/laysauchoa)\
**Replies:** 0\
**Last updated:** [July 28, 2022, 9:08am UTC](https://forum.opensearch.org/t/learn-how-to-write-opensearch-queries-with-python/10409 "2022-07-28T09:08:22Z")

</div>

Hi, I am sharing this blog post that I wrote about “How to write OpenSearch queries with the Python client” :snake: Hope it is useful!

---

## [Opensearch dynamic mapping False](https://forum.opensearch.org/t/opensearch-dynamic-mapping-false/10056)

<div class="topic-metadata">

**Author:** [@glory1g](https://forum.opensearch.org/u/glory1g)\
**Replies:** 1\
**Last updated:** [June 30, 2022, 2:44am UTC](https://forum.opensearch.org/t/opensearch-dynamic-mapping-false/10056 "2022-06-30T02:44:15Z")

</div>

so currently I’m trying to migrate my base code from elastic-search 6.x to opensearch 1.2, i’m using opensearch-dsl=2.0.1 my elasticsearch output: {'settings': {'number\_of\_shards': 3, 'number\_of\_replicas': 1, 'refresh\_…

---

## [Framework/multiprocessing support for opensearch-py?](https://forum.opensearch.org/t/framework-multiprocessing-support-for-opensearch-py/9249)

<div class="topic-metadata">

**Author:** [@atransm](https://forum.opensearch.org/u/atransm)\
**Replies:** 0\
**Last updated:** [April 14, 2022, 7:14pm UTC](https://forum.opensearch.org/t/framework-multiprocessing-support-for-opensearch-py/9249 "2022-04-14T19:14:32Z")

</div>

I am using Python3 and the Pyramid framework behind Green Unicorn. What is the recommended way of using the OpenSearch client? For example, should I instantiate a new one before each call to OpenSearch? Or, can it handl…

---

## [New bug patch release for opensearch-py?](https://forum.opensearch.org/t/new-bug-patch-release-for-opensearch-py/8805)

<div class="topic-metadata">

**Author:** [@nstender](https://forum.opensearch.org/u/nstender)\
**Replies:** 1\
**Last updated:** [March 3, 2022, 2:31pm UTC](https://forum.opensearch.org/t/new-bug-patch-release-for-opensearch-py/8805 "2022-03-03T14:31:05Z")

</div>

Hey team! Would it be possible to get a bug-fix patch for opensearch-py? Hoping to get a version that includes this fix: Parse raw\_data on error only if the Content-Type is application/json. by mccullocht · Pull Request…

---

## [Python Client for Alerting and Plugins](https://forum.opensearch.org/t/python-client-for-alerting-and-plugins/7845)

<div class="topic-metadata">

**Author:** [@arnavdas88](https://forum.opensearch.org/u/arnavdas88)\
**Replies:** 2\
**Last updated:** [December 3, 2021, 4:56pm UTC](https://forum.opensearch.org/t/python-client-for-alerting-and-plugins/7845 "2021-12-03T16:56:52Z")

</div>

Hi, I have created an Issue(for a feature) and a pull request in opensearch-py for “OpenSearch Plugins” API. It has been 12 days and I have still not heard anything from the team. I can understand that it is not the prio…

---

## [OpenSearch high level client library for Python (Elasticsearch-DSL equivalent)](https://forum.opensearch.org/t/opensearch-high-level-client-library-for-python-elasticsearch-dsl-equivalent/6877)

<div class="topic-metadata">

**Author:** [@MadhavVij](https://forum.opensearch.org/u/MadhavVij)\
**Replies:** 2\
**Last updated:** [October 14, 2021, 6:07am UTC](https://forum.opensearch.org/t/opensearch-high-level-client-library-for-python-elasticsearch-dsl-equivalent/6877 "2021-10-14T06:07:15Z")

</div>

Hi, Thanks for porting low level client libraries from Elasticsearch to OpenSearch. Is there a high level client library for python (like we have Elasticsearch-dsl available) in the works? This will help move to OpenSe…
