Elasticsearch-py: [7.7.0] DeprecationWarning types removal on es.update

Created on 25 May 2020  路  3Comments  路  Source: elastic/elasticsearch-py

Describe the feature: I am calling es.update with index, id and body, everytime I get:

ElasticsearchDeprecationWarning: [types removal] Specifying types in document update requests is deprecated, use the endpoint /{index}/_update/{id} instead.

Elasticsearch version (bin/elasticsearch --version): 7.7.0

elasticsearch-py version (elasticsearch.__versionstr__): 7.7.0

Description of the problem including expected versus actual behavior:
The function es.update works but I get this annoying log for each request.

Steps to reproduce:
I have wrapped the call in the function:

import datetime
import os  # get environment variables
import elasticsearch

URL_ELASTIC = os.environ.get("URL_ELASTIC")
INDEXNAME = "documents"
ES = elasticsearch.Elasticsearch(hosts=[URL_ELASTIC])

def doc_close_update(
    es_id,
    msgresponse,
):
    """Updates documents with final time and message."""
    body = {
        "doc": {
            "msgresponse": msgresponse,
            "timeresponse": datetime.datetime.utcnow(),
            "error": False,
        }
    }
    return ES.update(index=INDEXNAME, id=es_id, body=body)

Most helpful comment

Closed via https://github.com/elastic/elasticsearch-py/pull/1253 will be released in 7.7.1 today.

All 3 comments

I've seen this, it has been reported by another user as well and I'm working on a fix in https://github.com/elastic/elasticsearch-py/pull/1249 which will be eventually released as 7.7.1.

Closed via https://github.com/elastic/elasticsearch-py/pull/1253 will be released in 7.7.1 today.

@sethmlarson tested and worked, thanks a lot!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

peta15 picture peta15  路  6Comments

ApproximateIdentity picture ApproximateIdentity  路  5Comments

geudrik picture geudrik  路  6Comments

alanbacon picture alanbacon  路  3Comments

tirkarthi picture tirkarthi  路  6Comments