繁体   English   中英

未找到searchkick 400 [searchkick_search]

[英]searchkick 400 [searchkick_search] not found

有人用searchkick遇到这种问题吗? 我做错事情了? 有人可以提示吗?

谢谢

控制器:

@products = Product.search(params[:query], page: params[:page])

模型:

after_touch :reindex

 searchkick mappings: {
    product: {
      properties: {
        name: {type: "string", analyzer: "keyword"}
      }
    }
  }
   def search_data
    as_json only: [:name, :price]
    # or equivalently
    {
      name: name,
      price: price
    }
   end

[400] {“error”:{“root_cause”:[{“type”:“query_parsing_exception”,“reason”:“[match] analyzer [searchkick_search] not found”,“index”:“products_development_20151125203817235”,“line” :1,“col”:89}],“type”:“search_phase_execution_exception”,“reason”:“所有分片失败”,“阶段”:“查询”,“分组”:true,“failed_shards”:[{“ shard“:0,”index“:”products_development_20151125203817235“,”node“:”f2jvKNboRcGf0NF11yEqyw“,”reason“:{”type“:”query_parsing_exception“,”reason“:”[match] analyzer [searchkick_search] not found“, “索引”: “products_development_20151125203817235”, “线”:1, “栏”:89}}]}, “状态”:400}

merge_mappings变量设置为true

after_touch :reindex

 searchkick merge_mappings: true, mappings: {
    product: {
      properties: {
        name: {type: "string", analyzer: "keyword"}
      }
    }
  }
   def search_data
    as_json only: [:name, :price]
    # or equivalently
    {
      name: name,
      price: price
    }
   end

然后运行rake searchkick:reindex:allModel.reindex

希望这可以帮助。 祝好运!

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM