简体   繁体   English

Elasticsearch :: Transport :: Transport :: Errors :: NotFound:[404]

[英]Elasticsearch::Transport::Transport::Errors::NotFound: [404]

I'm using ElasticSearch as full text engine for my rails pet project app for my Post model. 我正在使用ElasticSearch作为我的Post模型的rails pet项目应用程序的全文引擎。 In my posts_controller.rb index action: 在我的posts_controller.rb索引操作中:

    def index
        if params[:query]
            @posts = Post.search(params[:query]).page(params[:page]).records
        else
            @posts = Post.paginate(page: params[:page]).order('created_at DESC')  
        end
    end

Where, if a query param is present he should filter the results and present it to the index.html.erb . 其中,如果存在查询参数,则应过滤结果并将其呈现给index.html.erb

What happens is I get 我得到的是什么

Elasticsearch::Transport::Transport::Errors::NotFound: [404] {"error":"IndexMissingException[[posts] missing]","status":404}

I ran the bundle exec rake environment elasticsearch:import:model CLASS='Post' but I still get the same error. 我运行bundle exec rake environment elasticsearch:import:model CLASS='Post'但我仍然得到相同的错误。

In the words of Marvin Gaye, What's going on? 用Marvin Gaye的话说,发生了什么?

Try: 尝试:

bundle exec rake environment elasticsearch:import:model CLASS='Post' FORCE=true

Note FORCE=true . 注意FORCE=true

This Error came for me as well, and i resolved it through following, 这个错误也出现了,我通过以下方式解决了这个问题,

go to Rails Console - CTRL , and then create index at your MODEL, 转到Rails控制台 - CTRL,然后在你的MODEL上创建索引,

MODEL_NAME.import force: true

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Activeadmin破坏记录,并在管理中出现Elasticsearch :: Transport :: Transport :: Errors :: NotFound异常[404] - Activeadmin Destroy Record with Exception Elasticsearch::Transport::Transport::Errors::NotFound in Admin [404] Elasticsearch :: Transport :: Transport :: Errors :: NotFound([404] {“错误”:{“ root_cause”:[{“类型”:“ index_not_found_exception” - Elasticsearch::Transport::Transport::Errors::NotFound ([404] {“error”:{“root_cause”:[{“type”:“index_not_found_exception” Elasticsearch ::运输::运输::错误:: BadRequest错误heroku - Elasticsearch::Transport::Transport::Errors::BadRequest error heroku 搜索#search中的Rails:Elasticsearch :: Transport :: Transport :: Errors :: BadRequest - Rails: Elasticsearch::Transport::Transport::Errors::BadRequest in Search#search 使用ActiveAdmin,SearchKick和SearchBox在Heroku上出现Elasticsearch :: Transport :: Transport :: Errors - Elasticsearch::Transport::Transport::Errors on Heroku with ActiveAdmin, SearchKick and SearchBox Elasticsearch::Transport::Transport::Errors::BadRequest [400] 创建索引时 - Elasticsearch::Transport::Transport::Errors::BadRequest [400] while creating index Elasticsearch :: Transport :: Transport :: Errors :: NotAcceptable:[406] {“错误”:“不支持Content-Type标头[]”,“状态”:406} - Elasticsearch::Transport::Transport::Errors::NotAcceptable: [406] {“error”:“Content-Type header [] is not supported”,“status”:406} Elasticsearch::Transport::Transport::Errors::Forbidden: [403] 发送超过 1200 个字符的文本字段时出错 - Elasticsearch::Transport::Transport::Errors::Forbidden: [403] error when sending text fields with more than 1200 characters 如何禁用 HTTP 严格传输安全? - How to disable HTTP Strict Transport Security? # <RestClient::NotFound: 404 Not Found> 错误+其余客户宝石 - #<RestClient::NotFound: 404 Not Found> error + rest-client gem
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM