Give all documents the same type name

ES6 no longer supports multiple types in the same index
pull/4502/merge
Karl Hobley 2017-12-14 15:05:25 +00:00 zatwierdzone przez Matt Westcott
rodzic feeeb6410f
commit 24edeb39b0
2 zmienionych plików z 7 dodań i 4 usunięć

Wyświetl plik

@ -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()

Wyświetl plik

@ -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'},