diff --git a/wagtail/search/backends/elasticsearch6.py b/wagtail/search/backends/elasticsearch6.py index 71b7cc3a53..43f5ae3017 100644 --- a/wagtail/search/backends/elasticsearch6.py +++ b/wagtail/search/backends/elasticsearch6.py @@ -6,6 +6,9 @@ from .elasticsearch5 import ( class Elasticsearch6Mapping(Elasticsearch5Mapping): all_field_name = '_all_text' + def get_document_type(self): + return 'doc' + def get_mapping(self): mapping = super().get_mapping() diff --git a/wagtail/search/tests/test_elasticsearch6_backend.py b/wagtail/search/tests/test_elasticsearch6_backend.py index 13c871eb42..08cdd3325e 100644 --- a/wagtail/search/tests/test_elasticsearch6_backend.py +++ b/wagtail/search/tests/test_elasticsearch6_backend.py @@ -508,7 +508,7 @@ class TestElasticsearch6Mapping(TestCase): self.obj = models.Book.objects.get(id=4) def test_get_document_type(self): - self.assertEqual(self.es_mapping.get_document_type(), 'searchtests_book') + self.assertEqual(self.es_mapping.get_document_type(), 'doc') def test_get_mapping(self): # Build mapping @@ -516,7 +516,7 @@ class TestElasticsearch6Mapping(TestCase): # Check expected_result = { - 'searchtests_book': { + 'doc': { 'properties': { 'pk': {'type': 'keyword', 'store': True}, 'content_type': {'type': 'keyword'}, @@ -594,7 +594,7 @@ class TestElasticsearch6MappingInheritance(TestCase): self.obj = models.Novel.objects.get(id=4) def test_get_document_type(self): - self.assertEqual(self.es_mapping.get_document_type(), 'searchtests_book_searchtests_novel') + self.assertEqual(self.es_mapping.get_document_type(), 'doc') def test_get_mapping(self): # Build mapping @@ -602,7 +602,7 @@ class TestElasticsearch6MappingInheritance(TestCase): # Check expected_result = { - 'searchtests_book_searchtests_novel': { + 'doc': { 'properties': { # New 'searchtests_novel__setting': {'type': 'text', 'copy_to': '_all_text', 'analyzer': 'edgengram_analyzer', 'search_analyzer': 'standard'},