gpt4 book ai didi

django - 请求错误(400,u'action_request_validation_exception',u'验证失败 : 1: type is missing;

转载 作者:行者123 更新时间:2023-12-02 22:12:12 25 4
gpt4 key购买 nike

我正在关注 https://github.com/sabricot/django-elasticsearch-dsl索引我的 django 模型中的数据。
我已将我的文档.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 和客户端?

并按照这些链接和下面的链接查看可兼容的版本:

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.

关于django - 请求错误(400,u'action_request_validation_exception',u'验证失败 : 1: type is missing;,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57643842/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com