Questions tagged [elasticsearch-py]

Python's official low-level client for Elasticsearch

194 questions
0
votes
1 answer

elasticsearch-py HTTPS_PROXY Variable Ignored - Corporate Proxy

I tried to use this code to utilize the python requests library to connect through a corporate HTTP proxy to elasticsearch by specifying the HTTPS_PROXY environment variable, but it seems like when I try to connect over HTTPS the HTTPS_PROXY…
0
votes
1 answer

About the `Elasticsearch.index()` method, is it using PUT or POST?

We are looking into a Python library Elasticsearch Python Client, and its official online document contains the below example for ingesting data into Elastic. We hope to make the ingest action idempotent, so we wonder whether the library's index()…
James
  • 1,373
  • 3
  • 13
  • 27
0
votes
1 answer

Partial text-formatted date match with Elasticsearch regexp

I formatted a date field dob as text dob.strftime("%m/%d/%Y") and stored these dates on Elasticsearch 8.7.1 ("lucene_version": "9.5.0") so I could utilize regexp to do partial date matching. Suppose this date is stored on Elasticsearch: 06/01/2023,…
0
votes
0 answers

Get the phrase found by elastic search in a complex bool query

I have a pretty complex query that is running in the search API (elastic python client search API) for very large amount of phrases with some other constriens query = { "query": { "bool": { …
Latent
  • 556
  • 1
  • 9
  • 23
0
votes
1 answer

Elasticsearch Python - No viable nodes were discovered on the initial sniff attempt

I have a cluster of Elasticsearch nodes running on different AWS EC2 instances. They internally connect via a network within AWS, so their network and discovery addresses are set up within this internal network. I want to use the python…
xerox102
  • 101
  • 11
0
votes
1 answer

Elasticsearch-Py Bulk Helper expected field [create], [delete], [index] or [update] but found [_op_type]'

I'm currently trying to bulk index a bunch of documents to a data stream in elastic using Python and I'm getting strange errors. Here is my code: for event in raw: tmp = { "@timestamp": event['timestamp'], …
helplessMax
  • 63
  • 2
  • 6
0
votes
1 answer

Bulk indexing in elasticsearch 8.x : 'Action/metadata line [1] contains an unknown parameter [_type]'

I have been trying to do a bulk index in the elasticsearch 8.x using this: from elasticsearch.helpers import bulk as bulk_indexer success, failed = bulk_indexer(self.es_client, actions, stats_only=True, chunk_size=900) Apparently i am seeing…
0
votes
0 answers

Get all documents via elasticsearch-py scan

I have a small problem regarding elasticsearch-py. I need to access data from Elastic in Python. I do this via the search() api: def get_data_from_elastic(): query = { "query": { "match_all": {} } } rel =…
0
votes
0 answers

Searching and indexing csv file with Python elasticsearch

I want to open f.csv file consisting of 5 rows x 17 columns with python elasticsearch, index the contents and then search over any text_id value in the column I can load elasticsearch a csv file and query it for id. but I can't search in it…
0
votes
2 answers

Provide the "script" argument in elasticsearch-py

I am trying to replicate the following curl commando in elasticsearch-py: curl -XGET "localhost:9200/my-exact-knn-index/_search?pretty" -H 'Content-Type: application/json' -d' { "query": { "script_score": { "query" : { "bool" :…
mabergerx
  • 1,216
  • 7
  • 19
0
votes
1 answer

Bulk index / create documents with elasticsearch for python

I am generating a large number of elasticsearch documents with random content using python and index them with elasticsearch-py. Simplified working example (document with just one field): from elasticsearch import Elasticsearch from random import…
buddemat
  • 4,552
  • 14
  • 29
  • 49
0
votes
1 answer

"document_missing_exception" at Opensearch client.update (python)

My query is simple - add field:value to existing doc, but it fails with error of document_missing_exception. the code below is without parameters to make it easy to view i use opensearch py client and set the index,co_type as that indx, id of the…
0
votes
1 answer

Periodically process and update documents in elasticsearch index

I need to come up with a strategy to process and update documents in an elasticsearch index periodically and efficiently. I do not have to look at documents that I processed before. My setting is that I have a long running process, which…
matthaeus
  • 797
  • 2
  • 7
  • 17
0
votes
2 answers

Partially updating elasticsearch list field value using python

The purpose of this question is to ask the community how to go about partially updating a field without removing any other contents of that field. There are many examples in StackOverflow to partially update ElasticSearch _source fields using…
0
votes
1 answer

Does the AsyncElasticsearch client use the same session for async actions?

Does the AsyncElasticsearch client open a new session for each async request? AsyncElasticsearch (from elasticsearch-py) uses AIOHTTP. From what I understand, AIOHTTP recommends a using a context manager for the aiohttp.ClientSession object, so as…