question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Multiple ElasticsearchDeprecationWarning using Elasticsearch 7.7.0

See original GitHub issue

Issue Summary

With elasticsearch-py 7.7.0 and Elasticsearch 7.7.0, I’m getting the following deprecation warnings on ./manage.py update_index:

(venv) ➜  wagtail-elasticsearch-7.7.0 ./manage.py update_index
Updating backend: default
default: Rebuilding index wagtail__wagtailcore_page
/Users/yngve/Repositories/issues/wagtail-elasticsearch-7.7.0/venv/lib/python3.7/site-packages/wagtail/search/backends/elasticsearch2.py:795: ElasticsearchDeprecationWarning: The [nGram] tokenizer name is deprecated and will be removed in a future version. Please change the tokenizer name to [ngram] instead.
  self.es.indices.create(self.name, self.backend.settings)
/Users/yngve/Repositories/issues/wagtail-elasticsearch-7.7.0/venv/lib/python3.7/site-packages/wagtail/search/backends/elasticsearch2.py:795: ElasticsearchDeprecationWarning: The [edgeNGram] tokenizer name is deprecated and will be removed in a future version. Please change the tokenizer name to [edge_ngram] instead.
  self.es.indices.create(self.name, self.backend.settings)
/Users/yngve/Repositories/issues/wagtail-elasticsearch-7.7.0/venv/lib/python3.7/site-packages/wagtail/search/backends/elasticsearch2.py:795: ElasticsearchDeprecationWarning: The [edgeNGram] token filter name is deprecated and will be removed in a future version. Please change the filter name to [edge_ngram] instead.
  self.es.indices.create(self.name, self.backend.settings)
/Users/yngve/Repositories/issues/wagtail-elasticsearch-7.7.0/venv/lib/python3.7/site-packages/wagtail/search/backends/elasticsearch2.py:795: ElasticsearchDeprecationWarning: The [nGram] token filter name is deprecated and will be removed in a future version. Please change the filter name to [ngram] instead.
  self.es.indices.create(self.name, self.backend.settings)
/Users/yngve/Repositories/issues/wagtail-elasticsearch-7.7.0/venv/lib/python3.7/site-packages/wagtail/search/backends/elasticsearch7.py:25: ElasticsearchDeprecationWarning: The [nGram] tokenizer name is deprecated and will be removed in a future version. Please change the tokenizer name to [ngram] instead.
  self.es.indices.put_mapping(index=self.name, body=mapping.get_mapping())
/Users/yngve/Repositories/issues/wagtail-elasticsearch-7.7.0/venv/lib/python3.7/site-packages/wagtail/search/backends/elasticsearch7.py:25: ElasticsearchDeprecationWarning: The [edgeNGram] tokenizer name is deprecated and will be removed in a future version. Please change the tokenizer name to [edge_ngram] instead.
  self.es.indices.put_mapping(index=self.name, body=mapping.get_mapping())
/Users/yngve/Repositories/issues/wagtail-elasticsearch-7.7.0/venv/lib/python3.7/site-packages/wagtail/search/backends/elasticsearch7.py:25: ElasticsearchDeprecationWarning: The [edgeNGram] token filter name is deprecated and will be removed in a future version. Please change the filter name to [edge_ngram] instead.
  self.es.indices.put_mapping(index=self.name, body=mapping.get_mapping())
/Users/yngve/Repositories/issues/wagtail-elasticsearch-7.7.0/venv/lib/python3.7/site-packages/wagtail/search/backends/elasticsearch7.py:25: ElasticsearchDeprecationWarning: The [nGram] token filter name is deprecated and will be removed in a future version. Please change the filter name to [ngram] instead.
  self.es.indices.put_mapping(index=self.name, body=mapping.get_mapping())
/Users/yngve/Repositories/issues/wagtail-elasticsearch-7.7.0/venv/lib/python3.7/site-packages/elasticsearch/helpers/actions.py:122: ElasticsearchDeprecationWarning: [types removal] Specifying types in bulk requests is deprecated.
  resp = client.bulk("\n".join(bulk_actions) + "\n", *args, **kwargs)
default: home.HomePage             .
default: wagtailcore.Page          .
default: indexed 2 objects

default: Rebuilding index wagtail__wagtaildocs_document
default: wagtaildocs.Document
default: indexed 0 objects

default: Rebuilding index wagtail__wagtailimages_image
default: wagtailimages.Image
default: indexed 0 objects

Considering that these are just deprecation warnings, we are not in a hurry to get rid of them.

Steps to Reproduce

  1. Install Elasticsearch 7.7.0
  2. Clone https://github.com/yhoiseth/wagtail-elasticsearch-7.7.0 (just a fresh Wagtail project configured for Elasticsearch and with elasticsearch-py in requirements.txt)
  3. pip install -r requirements.txt
  4. ./manage.py migrate
  5. ./manage.py update_index
  • I have confirmed that this issue can be reproduced as described on a fresh Wagtail project: yes

Technical details

  • Python version: 3.7.7
  • Django version: 3.0.6
  • Wagtail version: 2.9
  • Browser version: Not relevant

Elasticsearch

(venv) ➜  wagtail-elasticsearch-7.7.0 git:(master) curl localhost:9200
{
  "name" : "Yngves-2015-MacBook-Pro.local",
  "cluster_name" : "elasticsearch_yngve",
  "cluster_uuid" : "xH8J69c9ToCQLKUN3cFeuA",
  "version" : {
    "number" : "7.7.0",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "81a1e9eda8e6183f5237786246f6dced26a10eaf",
    "build_date" : "2020-05-12T02:01:37.602180Z",
    "build_snapshot" : false,
    "lucene_version" : "8.5.1",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
kaedrohocommented, May 19, 2020

Thanks for reporting! Looks like these are two really simple changes for the Elasticsearch 7 backend:

  • Change occurances of nGram to ngram and edgeNGram to edge_ngram
  • Remove the _type parameter from the bulk request (not used in recent Elasticsearch versions anyway)
Read more comments on GitHub >

github_iconTop Results From Across the Web

Elasticsearch version 7.7.0 | Elasticsearch Guide [7.17] | Elastic
SQL: If a WHERE clause contains at least two relational operators joined by ... a deprecation warning for indices created in Elasticsearch 7.7.0...
Read more >
Release notes | Elasticsearch Python Client [7.17] | Elastic
Changed the DeprecationWarning for the body parameter to be a "removed in a future version" instead of "removed in 8.0" in line with...
Read more >
Elasticsearch 7.7.0 released | Elastic Blog
We are pleased to announce the release of Elasticsearch 7.7.0, ... many more features (e.g., two new aggregations) included with the release ...
Read more >
Elasticsearch 7.7.0 | Elastic
The pure Apache 2.0 licensed distribution is available here. The distribution that's not bundled with a JDK is available here. You can obtain...
Read more >
Breaking changes in 7.7 | Elasticsearch Guide [7.17] | Elastic
If you configure more than one realm of any type with the same order, the node will fail to start. Deprecation of insecure...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found