2015-11-26 1 views
2

Quelqu'un a ce genre de problème avec searchkick? J'ai fait quelque chose de mal? quelqu'un peut laisser un indice?searchkick 400 [searchkick_search] pas trouvé

merci contrôleur de

:

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

modèle :

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] { "erreur": { "ROOT_CAUSE": [{ » tapez ":" query_parsing_exception "," raison ":" [match] analyseur [searchkick_search] pas " trouvé", "index": "products_development_20151125203817235", "line": 1, "col": 89}], "type": "search_phase_execution_exception", "raison": "tous partitions échoué "," phase ":" requête "," groupé ": true," failed_shards ": [{" shard ": 0," index ":" products_development_20151125203817235 "," nœud ":" f2jvKNboRcGf0NF11yEqyw "," raison ": {" tapez ":" query_parsing_exception "," raison ":" [match] analyseur [searchkick_search] pas trouvé "," index ":" products_development_20151125203817235 "," line ": 1," col ": 89}}]}," état ": 400}

Répondre

1

Définissez votre variable 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 

Ensuite, exécutez rake searchkick:reindex:all ou Model.reindex

Hope this helps. Bonne chance!

+1

Afin de pouvoir utiliser les fonctionnalités de recherche de searchkick –

+1

right! Merci mec –