RequestError(400, u'action_request_validation_exception', u'验证失败:1:缺少类型;
RequestError(400, u'action_request_validation_exception', u'Validation Failed: 1: type is missing;
我正在关注 https://github.com/sabricot/django-elasticsearch-dsl 以索引我的 django-model 中的数据。
我已将 documents.py 文件定义为 :->
from django_elasticsearch_dsl import Document , fields
from django_elasticsearch_dsl.registries import registry
from abc.models import *
from elasticsearch_dsl import connections, field, analyzer
connections.create_connection(hosts=['localhost'], timeout=20)
@registry.register_document
class ParkingDocument(Document):
class Index:
# Name of the Elasticsearch index
name = 'parking'
# See Elasticsearch Indices API reference for available settings
settings = {'number_of_shards': 1,
'number_of_replicas': 0}
class Django:
model = ParkingLocation
fields = [
'created',
'updated',
]
当我运行命令
python manage.py search_index --rebuild
。
我收到标题中提到的错误。任何帮助将不胜感激。
看起来您正在使用旧版本的 elasticsearch,其中 types 是强制性的,但在您的查询中,您没有包含它。
在当前版本的 ES 中,不推荐使用类型 see。请提供您使用的是哪个版本的 elasticsearch 和客户端?
并按照这些 link 和下面的内容查看可兼容的版本:
Indices created in Elasticsearch 6.0.0 or later may only contain a
single mapping type. Indices created in 5.x with multiple mapping
types will continue to function as before in Elasticsearch 6.x. Types
will be deprecated in APIs in Elasticsearch 7.0.0, and completely
removed in 8.0.0.
我正在关注 https://github.com/sabricot/django-elasticsearch-dsl 以索引我的 django-model 中的数据。 我已将 documents.py 文件定义为 :->
from django_elasticsearch_dsl import Document , fields
from django_elasticsearch_dsl.registries import registry
from abc.models import *
from elasticsearch_dsl import connections, field, analyzer
connections.create_connection(hosts=['localhost'], timeout=20)
@registry.register_document
class ParkingDocument(Document):
class Index:
# Name of the Elasticsearch index
name = 'parking'
# See Elasticsearch Indices API reference for available settings
settings = {'number_of_shards': 1,
'number_of_replicas': 0}
class Django:
model = ParkingLocation
fields = [
'created',
'updated',
]
当我运行命令
python manage.py search_index --rebuild
。
我收到标题中提到的错误。任何帮助将不胜感激。
看起来您正在使用旧版本的 elasticsearch,其中 types 是强制性的,但在您的查询中,您没有包含它。
在当前版本的 ES 中,不推荐使用类型 see。请提供您使用的是哪个版本的 elasticsearch 和客户端?
并按照这些 link 和下面的内容查看可兼容的版本:
Indices created in Elasticsearch 6.0.0 or later may only contain a single mapping type. Indices created in 5.x with multiple mapping types will continue to function as before in Elasticsearch 6.x. Types will be deprecated in APIs in Elasticsearch 7.0.0, and completely removed in 8.0.0.