Track.search("sa", min" /> Track.search("sa", min" /> Track.search("sa", min"/>

Searchkick::InvalidQueryError in rails 3 + Searchkick

18 Views Asked by At

I am getting this query error after running these search queries -

2.2.0 :086 > Track.search("sa", min_score: 0.2)
Searchkick::InvalidQueryError: [400] {"error":{"root_cause":[{"type":"parsing_exception","reason":"The field [fields] is no longer supported, please use [stored_fields] to retrieve stored fields or _source filtering if the field is not stored","line":1,"col":522}],"type":"parsing_exception","reason":"The field [fields] is no longer supported, please use [stored_fields] to retrieve stored fields or _source filtering if the field is not stored","line":1,"col":522},"status":400}
tracks = Track.select(:id).search :query =>{
      queryString: {
       fields: ["tags^5", "category_names^2", "description^5","name^1", "id^1"],
       query: query.blank? ? "*" : query
      }
    },
    :order => order,
    :where => {
      :category_ids => (@criteria.criteria[:genres].blank? ? Category.all.map{|c| c.id } : @criteria.criteria[:genres].map{|g| g.gsub('"',"").to_i} ),
      :search_length => (@criteria.criteria[:minlength].blank? ? 0 : @criteria.criteria[:minlength] )..(@criteria.criteria[:maxlength].blank? ? 600 : @criteria.criteria[:maxlength] ),
      :status_id => 2
    } ,
    :page => page,
    :per_page => params[:per_page],
    :explain => true,
    include: [:user],
    fuzziness: 0.2, max_expansions: 3, analyzer: "searchkick_search2", min_score: 0.2

Searchkick::InvalidQueryError: [400] {"error":{"root_cause":[{"type":"parsing_exception","reason":"no [query] registered for [queryString]","line":1,"col":25}],"type":"parsing_exception","reason":"no [query] registered for [queryString]","line":1,"col":25},"status":400}

I also tried other query structures but didn't get rid of this problem. In my Gemfile -

gem "searchkick", path: "vendor/searchkick"

My Gemfile.lock -

GIT
  remote: git://github.com/joshualcoffee/waveform.git
  revision: 2e73d99411b99d30862950791897c425e2ac3617
  specs:
    waveform (0.1.2)
      chunky_png
      ruby-audio

GIT
  remote: https://github.com/ActsAsParanoid/acts_as_paranoid
  revision: 662037333f3e7a3923b1fe7c8aa6eb7d8b4f1d37
  branch: 0-4-stable
  specs:
    acts_as_paranoid (0.4.3)
      activerecord (~> 3.2)

GIT
  remote: https://github.com/carrierwaveuploader/carrierwave.git
  revision: d73990b510c72081202d032b3156ff53cae721b9
  branch: 0.10-stable
  specs:
    carrierwave (0.10.0)
      activemodel (>= 3.2.0)
      activesupport (>= 3.2.0)
      json (>= 1.7)
      mime-types (>= 1.16)

PATH
  remote: vendor/searchkick
  specs:
    searchkick (0.8.0)
      activemodel
      elasticsearch (>= 1)
      hashie

GEM
  remote: https://rubygems.org/
  specs:
    CFPropertyList (2.3.2)
    actionmailer (3.2.22)
      actionpack (= 3.2.22)
      mail (~> 2.5.4)
    actionpack (3.2.22)
      activemodel (= 3.2.22)
      activesupport (= 3.2.22)
      builder (~> 3.0.0)
      erubis (~> 2.7.0)
      journey (~> 1.0.4)
      rack (~> 1.4.5)
      rack-cache (~> 1.2)
      rack-test (~> 0.6.1)
      sprockets (~> 2.2.1)
    active_admin_editor (1.1.0)
      activeadmin (>= 0.4.0)
      ejs
      rails (>= 3.0.0)
    active_enum (0.9.12)
      activesupport (~> 3.0)
    activeadmin (0.6.6)
      arbre (~> 1.0)
      bourbon (>= 1.0.0, < 4)
      devise (>= 1.5.4, < 4)
      formtastic (~> 2.0)
      inherited_resources (~> 1.3)
      jquery-rails (>= 1.0.0, < 3)
      kaminari (~> 0.13, != 0.15.0)
      meta_search (~> 1.0)
      rails (>= 3.0.0, < 4)
      sass (~> 3.1)
    activemodel (3.2.22)
      activesupport (= 3.2.22)
      builder (~> 3.0.0)
    activerecord (3.2.22)
      activemodel (= 3.2.22)
      activesupport (= 3.2.22)
      arel (~> 3.0.2)
      tzinfo (~> 0.3.29)
    activeresource (3.2.22)
      activemodel (= 3.2.22)
      activesupport (= 3.2.22)
    activesupport (3.2.22)
      i18n (~> 0.6, >= 0.6.4)
      multi_json (~> 1.0)
    acts-as-taggable-on (2.3.3)
      rails (~> 3.0)
    addressable (2.4.0)
    arbre (1.0.3)
      activesupport (>= 3.0.0)
    arel (3.0.3)
    aws-sdk (2.2.9)
      aws-sdk-resources (= 2.2.9)
    aws-sdk-core (2.2.9)
      jmespath (~> 1.0)
    aws-sdk-resources (2.2.9)
      aws-sdk-core (= 2.2.9)
    babel-source (5.8.35)
    babel-transpiler (0.7.0)
      babel-source (>= 4.0, < 6)
      execjs (~> 2.0)
    bcrypt (3.1.10)
    bootstrap-sass (3.1.1.0)
      sass (~> 3.2)
    bourbon (3.2.4)
      sass (~> 3.2)
      thor
    builder (3.0.4)
    callsite (0.0.11)
    cancan (1.6.9)
    chosen-rails (0.13.2)
      coffee-rails (>= 3.2)
      compass-rails (>= 1.0)
      railties (>= 3.0)
      sass-rails (>= 3.2)
    chronic (0.9.1)
    chunky_png (1.2.9)
    coffee-rails (3.2.2)
      coffee-script (>= 2.2.0)
      railties (~> 3.2.0)
    coffee-script (2.4.1)
      coffee-script-source
      execjs
    coffee-script-source (1.10.0)
    coffeebeans (1.0.1)
      actionpack (>= 3.0.0)
      coffee-script
    colorbox-rails (0.1.2)
      jquery-rails
      rails (>= 3.1.1)
    compass (0.12.7)
      chunky_png (~> 1.2)
      fssm (>= 0.2.7)
      sass (~> 3.2.19)
    compass-rails (1.0.3)
      compass (>= 0.12.2, < 0.14)
    concurrent-ruby (1.0.0)
    connection_pool (2.2.0)
    countries (0.9.3)
      currencies (~> 0.4.2)
    country_select (1.3.1)
      countries (= 0.9.3)
    currencies (0.4.2)
    daemons (1.1.9)
    devise (3.5.6)
      bcrypt (~> 3.0)
      orm_adapter (~> 0.1)
      railties (>= 3.2.6, < 5)
      responders
      thread_safe (~> 0.1)
      warden (~> 1.2.3)
    diff-lcs (1.2.5)
    dotenv (2.0.1)
    dotenv-rails (2.0.1)
      dotenv (= 2.0.1)
    dynamic_form (1.1.4)
    dynamic_sitemaps (1.0.8)
    ejs (1.1.1)
    elasticsearch (1.0.4)
      elasticsearch-api (= 1.0.4)
      elasticsearch-transport (= 1.0.4)
    elasticsearch-api (1.0.4)
      multi_json
    elasticsearch-transport (1.0.4)
      faraday
      multi_json
    erubis (2.7.0)
    excon (0.45.4)
    execjs (2.6.0)
    factory_girl (4.4.0)
      activesupport (>= 3.0.0)
    factory_girl_rails (4.4.1)
      factory_girl (~> 4.4.0)
      railties (>= 3.0.0)
    faraday (0.9.0)
      multipart-post (>= 1.2, < 3)
    fission (0.5.0)
      CFPropertyList (~> 2.2)
    fog (1.37.0)
      fog-aliyun (>= 0.1.0)
      fog-atmos
      fog-aws (>= 0.6.0)
      fog-brightbox (~> 0.4)
      fog-core (~> 1.32)
      fog-dynect (~> 0.0.2)
      fog-ecloud (~> 0.1)
      fog-google (<= 0.1.0)
      fog-json
      fog-local
      fog-powerdns (>= 0.1.1)
      fog-profitbricks
      fog-radosgw (>= 0.0.2)
      fog-riakcs
      fog-sakuracloud (>= 0.0.4)
      fog-serverlove
      fog-softlayer
      fog-storm_on_demand
      fog-terremark
      fog-vmfusion
      fog-voxel
      fog-vsphere (>= 0.4.0)
      fog-xenserver
      fog-xml (~> 0.1.1)
      ipaddress (~> 0.5)
    fog-aliyun (0.1.0)
      fog-core (~> 1.27)
      fog-json (~> 1.0)
      ipaddress (~> 0.8)
      xml-simple (~> 1.1)
    fog-atmos (0.1.0)
      fog-core
      fog-xml
    fog-aws (0.8.0)
      fog-core (~> 1.27)
      fog-json (~> 1.0)
      fog-xml (~> 0.1)
      ipaddress (~> 0.8)
    fog-brightbox (0.10.1)
      fog-core (~> 1.22)
      fog-json
      inflecto (~> 0.0.2)
    fog-core (1.35.0)
      builder
      excon (~> 0.45)
      formatador (~> 0.2)
    fog-dynect (0.0.2)
      fog-core
      fog-json
      fog-xml
    fog-ecloud (0.3.0)
      fog-core
      fog-xml
    fog-google (0.1.0)
      fog-core
      fog-json
      fog-xml
    fog-json (1.0.2)
      fog-core (~> 1.0)
      multi_json (~> 1.10)
    fog-local (0.2.1)
      fog-core (~> 1.27)
    fog-powerdns (0.1.1)
      fog-core (~> 1.27)
      fog-json (~> 1.0)
      fog-xml (~> 0.1)
    fog-profitbricks (0.0.5)
      fog-core
      fog-xml
      nokogiri
    fog-radosgw (0.0.4)
      fog-core (>= 1.21.0)
      fog-json
      fog-xml (>= 0.0.1)
    fog-riakcs (0.1.0)
      fog-core
      fog-json
      fog-xml
    fog-sakuracloud (1.7.5)
      fog-core
      fog-json
    fog-serverlove (0.1.2)
      fog-core
      fog-json
    fog-softlayer (1.0.2)
      fog-core
      fog-json
    fog-storm_on_demand (0.1.1)
      fog-core
      fog-json
    fog-terremark (0.1.0)
      fog-core
      fog-xml
    fog-vmfusion (0.1.0)
      fission
      fog-core
    fog-voxel (0.1.0)
      fog-core
      fog-xml
    fog-vsphere (0.4.0)
      fog-core
      rbvmomi (~> 1.8)
    fog-xenserver (0.2.2)
      fog-core
      fog-xml
    fog-xml (0.1.2)
      fog-core
      nokogiri (~> 1.5, >= 1.5.11)
    font-awesome-rails (4.1.0.0)
      railties (>= 3.2, < 5.0)
    foreman (0.78.0)
      thor (~> 0.19.1)
    formatador (0.2.5)
    formtastic (2.3.1)
      actionpack (>= 3.0)
    foundation-rails (5.1.1.0)
      railties (>= 3.1.0)
      sass (>= 3.2.0)
    friendly_id (4.0.9)
    fssm (0.2.10)
    gabba (1.0.1)
    gon (6.0.1)
      actionpack (>= 3.0)
      json
      multi_json
      request_store (>= 1.0)
    haml (4.0.2)
      tilt
    haml-rails (0.4)
      actionpack (>= 3.1, < 4.1)
      activesupport (>= 3.1, < 4.1)
      haml (>= 3.1, < 4.1)
      railties (>= 3.1, < 4.1)
    has_scope (0.6.0)
      actionpack (>= 3.2, < 5)
      activesupport (>= 3.2, < 5)
    hashie (3.2.0)
    highcharts-rails (2.3.5)
      railties (>= 3.1)
    highrise (3.2.1)
      activeresource (>= 3.2.13)
    hike (1.2.3)
    httparty (0.11.0)
      multi_json (~> 1.0)
      multi_xml (>= 0.5.2)
    httpclient (2.7.1)
    i18n (0.8.1)
    impressionist (1.5.1)
      httpclient (~> 2.2)
      nokogiri (~> 1.5)
    inflecto (0.0.2)
    inherited_resources (1.6.0)
      actionpack (>= 3.2, < 5)
      has_scope (~> 0.6.0.rc)
      railties (>= 3.2, < 5)
      responders
    intercom (3.2.0)
      json (~> 1.8)
    intercom-rails (0.2.29)
      activesupport (> 3.0)
    ipaddress (0.8.2)
    jmespath (1.1.3)
    journey (1.0.4)
    jquery-rails (2.3.0)
      railties (>= 3.0, < 5.0)
      thor (>= 0.14, < 2.0)
    jquery-ui-rails (4.0.3)
      jquery-rails
      railties (>= 3.1.0)
    jquery-ui-sass-rails (4.0.3.0)
      jquery-rails
      jquery-ui-rails (= 4.0.3)
      railties (>= 3.1.0)
    jquery-ui-themes (0.0.8)
      httparty
    jquery-validation-rails (1.11.0)
      thor (~> 0.14)
    json (1.8.6)
    json_pure (1.8.0)
    kaminari (0.16.3)
      actionpack (>= 3.0.0)
      activesupport (>= 3.0.0)
    kgio (2.9.2)
    launchy (2.4.3)
      addressable (~> 2.3)
    letter_opener (1.4.1)
      launchy (~> 2.2)
    letter_opener_web (1.2.3)
      letter_opener (~> 1.0)
      rails (>= 3.2)
    lol_dba (1.5.0)
      actionpack (>= 3.0)
      activerecord (>= 3.0)
      railties (>= 3.0)
    mail (2.5.4)
      mime-types (~> 1.16)
      treetop (~> 1.4.8)
    meta_request (0.2.8)
      callsite
      rack-contrib
      railties
    meta_search (1.1.3)
      actionpack (~> 3.1)
      activerecord (~> 3.1)
      activesupport (~> 3.1)
      polyamorous (~> 0.5.0)
    mime-types (1.25.1)
    mini_portile2 (2.0.0)
    mixpanel-ruby (2.2.0)
    multi_json (1.12.1)
    multi_xml (0.5.3)
    multipart-post (2.0.0)
    mysql2 (0.3.21)
    net-ssh (2.7.0)
    newrelic_rpm (3.6.0.83)
    nokogiri (1.6.7.1)
      mini_portile2 (~> 2.0.0.rc2)
    oily_png (1.1.0)
      chunky_png (~> 1.2.7)
    orm_adapter (0.5.0)
    polyamorous (0.5.0)
      activerecord (~> 3.0)
    polyglot (0.3.5)
    postmark (0.9.19)
      json
      rake
    postmark-mitt (0.0.11)
      json_pure
      multi_json
    postmark-rails (0.4.1)
      actionmailer
      postmark (>= 0.9.0)
      rake
    rack (1.4.7)
    rack-cache (1.7.0)
      rack (>= 0.4)
    rack-contrib (1.1.0)
      rack (>= 0.9.1)
    rack-protection (1.5.3)
      rack
    rack-ssl (1.3.4)
      rack
    rack-test (0.6.3)
      rack (>= 1.0)
    rails (3.2.22)
      actionmailer (= 3.2.22)
      actionpack (= 3.2.22)
      activerecord (= 3.2.22)
      activeresource (= 3.2.22)
      activesupport (= 3.2.22)
      bundler (~> 1.0)
      railties (= 3.2.22)
    rails-dev-tweaks (0.6.1)
      actionpack (~> 3.1)
      railties (~> 3.1)
    rails3-jquery-autocomplete (1.0.14)
      rails (>= 3.0)
    railties (3.2.22)
      actionpack (= 3.2.22)
      activesupport (= 3.2.22)
      rack-ssl (~> 1.3.2)
      rake (>= 0.8.7)
      rdoc (~> 3.4)
      thor (>= 0.14.6, < 2.0)
    raindrops (0.13.0)
    rake (12.0.0)
    rbvmomi (1.8.2)
      builder
      nokogiri (>= 1.4.1)
      trollop
    rdoc (3.12.2)
      json (~> 1.4)
    react-rails (1.5.0)
      babel-transpiler (>= 0.7.0)
      coffee-script-source (~> 1.8)
      connection_pool
      execjs
      rails (>= 3.2)
      tilt
    redis (3.2.2)
    redis-actionpack (3.2.4)
      actionpack (~> 3.2.0)
      redis-rack (~> 1.4.4)
      redis-store (~> 1.1.4)
    redis-activesupport (3.2.5)
      activesupport (~> 3.2.0)
      redis-store (~> 1.1.0)
    redis-rack (1.4.4)
      rack (~> 1.4.0)
      redis-store (~> 1.1.4)
    redis-rails (3.2.4)
      redis-actionpack (~> 3.2.4)
      redis-activesupport (~> 3.2.4)
      redis-store (~> 1.1.4)
    redis-store (1.1.7)
      redis (>= 2.2)
    request_store (1.3.0)
    responders (1.1.2)
      railties (>= 3.2, < 4.2)
    rest-client (1.6.7)
      mime-types (>= 1.16)
    rspec-core (3.0.2)
      rspec-support (~> 3.0.0)
    rspec-expectations (3.0.2)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.0.0)
    rspec-mocks (3.0.2)
      rspec-support (~> 3.0.0)
    rspec-rails (3.0.1)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      railties (>= 3.0)
      rspec-core (~> 3.0.0)
      rspec-expectations (~> 3.0.0)
      rspec-mocks (~> 3.0.0)
      rspec-support (~> 3.0.0)
    rspec-support (3.0.2)
    ruby-audio (1.6.1)
    sass (3.2.19)
    sass-rails (3.2.6)
      railties (~> 3.2.0)
      sass (>= 3.1.10)
      tilt (~> 1.3)
    select2-rails (3.5.2)
      thor (~> 0.14)
    selectize-rails (0.12.1)
    sidekiq (4.0.1)
      concurrent-ruby (~> 1.0)
      connection_pool (~> 2.2, >= 2.2.0)
      json (~> 1.0)
      redis (~> 3.2, >= 3.2.1)
    simple_form (2.1.3)
      actionpack (~> 3.0)
      activemodel (~> 3.0)
    sinatra (1.4.6)
      rack (~> 1.4)
      rack-protection (~> 1.4)
      tilt (>= 1.3, < 3)
    sprockets (2.2.3)
      hike (~> 1.2)
      multi_json (~> 1.0)
      rack (~> 1.0)
      tilt (~> 1.1, != 1.3.0)
    stripe (1.8.8)
      multi_json (>= 1.0.4, < 2)
      rest-client (~> 1.4)
    test-unit (2.1.1)
    thor (0.19.4)
    thread_safe (0.3.5)
    tilt (1.4.1)
    treetop (1.4.15)
      polyglot
      polyglot (>= 0.3.1)
    trollop (2.1.2)
    tzinfo (0.3.53)
    uglifier (2.0.1)
      execjs (>= 0.3.0)
      multi_json (~> 1.0, >= 1.0.2)
    unicorn (4.8.2)
      kgio (~> 2.6)
      rack
      raindrops (~> 0.7)
    warden (1.2.6)
      rack (>= 1.0)
    whenever (0.9.4)
      chronic (>= 0.6.3)
    will_paginate (3.0.4)
    xml-simple (1.1.5)

PLATFORMS
  ruby

DEPENDENCIES
  active_admin_editor
  active_enum
  activeadmin
  acts-as-taggable-on (~> 2.3.1)
  acts_as_paranoid!
  aws-sdk (~> 2)
  bootstrap-sass (~> 3.1.1)
  cancan
  carrierwave!
  chosen-rails
  chronic
  coffee-rails (~> 3.2.1)
  coffeebeans
  colorbox-rails
  country_select
  daemons
  devise
  dotenv-rails
  dynamic_form
  dynamic_sitemaps
  factory_girl_rails
  fog
  font-awesome-rails
  foreman
  foundation-rails (~> 5.1.1.0)
  friendly_id (~> 4.0.9)
  gabba
  gon
  haml-rails
  highcharts-rails (~> 2.3.0)
  highrise
  impressionist
  intercom
  intercom-rails
  jquery-rails (= 2.3.0)
  jquery-ui-sass-rails
  jquery-ui-themes
  jquery-validation-rails
  letter_opener
  letter_opener_web (~> 1.2.0)
  lol_dba
  meta_request
  mixpanel-ruby
  mysql2 (~> 0.3.21)
  net-ssh (= 2.7.0)
  newrelic_rpm
  oily_png
  postmark-mitt
  postmark-rails (= 0.4.1)
  rails (= 3.2.22)
  rails-dev-tweaks (~> 0.6.1)
  rails3-jquery-autocomplete
  react-rails (~> 1.5.0)
  redis-rails
  rspec-rails (~> 3.0.0)
  sass
  searchkick!
  select2-rails
  selectize-rails
  sidekiq
  simple_form
  sinatra
  stripe
  test-unit
  uglifier (>= 1.0.3)
  unicorn
  waveform!
  whenever
  will_paginate (~> 3.0)

BUNDLED WITH
   1.14.6

Searchkick version - 0.8.0 Rails version - 3.2.22 Ruby version - 2.2.0 enter image description here

In my project elasticsearch server is running on different droplet of digitalocean. And it is being connected successfully by this

@client ||= Elasticsearch::Client.new(url: ENV["ELASTICSEARCH_URL"])

I tried with updating my searchkick version to 1.5 but it is making version conflicts on my server and server down is caused. I also tried other types of structures to search but this error is occuring

Searchkick::InvalidQueryError: [400] {"error":{"root_cause":[{"type":"parsing_exception","reason":"The field [fields] is no longer supported, please use [stored_fields] to retrieve stored fields or _source filtering if the field is not stored","line":1,"col":522}],"type":"parsing_exception","reason":"The field [fields] is no longer supported, please use [stored_fields] to retrieve stored fields or _source filtering if the field is not stored","line":1,"col":522},"status":400}

I want to enable my searching functionality. I am not even able to search with simple query.

0

There are 0 best solutions below