首页 文章

Elasticsearch :: Transport :: Transport :: Errors :: NotFound([404] {“error”:{“root_cause”:[{“type”:“index_not_found_exception”

提问于
浏览
1

不确定在本地环境中工作 elasticsearch 我得到这个奇怪的错误,任何帮助我都会感激 . 谢谢

Elasticsearch :: Transport :: Transport :: Errors :: NotFound([404] {“error”:{“root_cause”:[{“type”:“index_not_found_exception”,“reason”:“no such index”,“resource” .type“:”index_or_alias“,”resource.id“:”发票“,”索引“:”发票“}],”类型“:”index_not_found_exception“,”原因“:”没有这样的索引“,”resource.type “:” index_or_alias”, “resource.id”: “发票”, “索引”: “发票”}, “状态”:404})

2 回答

  • 3

    您也可以按照我在rubydoc网站上找到的步骤操作:

    需要在您的应用程序中定义任务,例如 . 在lib / tasks / elasticsearch.rake文件中:

    require 'elasticsearch/rails/tasks/import'
    

    要从模型中导入记录,请运行:

    bundle exec rake environment elasticsearch:import:model CLASS='ModelName'
    

    或者您可以使用:

    rake environment elasticsearch:import:all DIR=app/models
    

    导入所有型号 .

  • 0

    修复了通过在 rails console 运行这些命令索引ES的问题: -

    Model.__elasticsearch__.create_index!
    Model.__elasticsearch__.create_index! force: true
    Model.import force: true
    

相关问题