I am trying to use AWS cloudsearch from rails console.
I was able to do simple query without specifying any filter query or parser. However on giving 'filterQuery' or 'queryParser'. AWS Ruby SDK throws exception.
Example :
Aws.config.update({region: 'us-west-2',credentials: Aws::Credentials.new(‘key_id', ’secret_key'), })
csd = Aws::CloudSearchDomain::Client.new(region: 'us-east-1', endpoint: 'http://search-endpoint.us-east-1.cloudsearch.amazonaws.com/')
1.9.3-p551 :075 > csd.search(query:'user*') # WORKED
=> #<struct Aws::CloudSearchDomain::Types::SearchResponse status=#<struct Aws::CloudSearchDomain::Types::SearchStatus timems=1, rid="z7vRxOYpgKEBCluMDg==">, hits=#<struct Aws::CloudSearchDomain::Types::Hits found=0, start=0, cursor=nil, hit=[]>, facets=nil>
1.9.3-p551 :076 > csd.search(query:'user*', queryParser:'simple') # NOT WORKING
ArgumentError: unexpected value at params[:queryParser]
from /Users/anshulgoyal/.rvm/gems/ruby-1.9.3-p551/gems/aws-sdk-core-2.1.2/lib/aws-sdk-core/param_validator.rb:26:in `validate!'
from /Users/anshulgoyal/.rvm/gems/ruby-1.9.3-p551/gems/aws-sdk-core-2.1.2/lib/aws-sdk-core/param_validator.rb:11:in `validate!'
from /Users/anshulgoyal/.rvm/gems/ruby-1.9.3-p551/gems/aws-sdk-core-2.1.2/lib/aws-sdk-core/plugins/param_validator.rb:20:in `call'
from /Users/anshulgoyal/.rvm/gems/ruby-1.9.3-p551/gems/aws-sdk-core-2.1.2/lib/seahorse/client/plugins/raise_response_errors.rb:14:in `call'
from /Users/anshulgoyal/.rvm/gems/ruby-1.9.3-p551/gems/aws-sdk-core-2.1.2/lib/aws-sdk-core/plugins/param_converter.rb:21:in `call'
from /Users/anshulgoyal/.rvm/gems/ruby-1.9.3-p551/gems/aws-sdk-core-2.1.2/lib/aws-sdk-core/plugins/response_paging.rb:26:in `call'
from /Users/anshulgoyal/.rvm/gems/ruby-1.9.3-p551/gems/aws-sdk-core-2.1.2/lib/seahorse/client/plugins/response_target.rb:18:in `call'
from /Users/anshulgoyal/.rvm/gems/ruby-1.9.3-p551/gems/aws-sdk-core-2.1.2/lib/seahorse/client/request.rb:70:in `send_request'
from /Users/anshulgoyal/.rvm/gems/ruby-1.9.3-p551/gems/aws-sdk-core-2.1.2/lib/seahorse/client/base.rb:207:in `block (2 levels) in define_operation_methods'
from (irb):76
from /Users/anshulgoyal/.rvm/gems/ruby-1.9.3-p551/gems/railties-4.2.3/lib/rails/commands/console.rb:110:in `start'
from /Users/anshulgoyal/.rvm/gems/ruby-1.9.3-p551/gems/railties-4.2.3/lib/rails/commands/console.rb:9:in `start'
from /Users/anshulgoyal/.rvm/gems/ruby-1.9.3-p551/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:68:in `console'
from /Users/anshulgoyal/.rvm/gems/ruby-1.9.3-p551/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /Users/anshulgoyal/.rvm/gems/ruby-1.9.3-p551/gems/railties-4.2.3/lib/rails/commands.rb:17:in `<top (required)>'
from /Users/anshulgoyal/.rvm/gems/ruby-1.9.3-p551/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `require'
from /Users/anshulgoyal/.rvm/gems/ruby-1.9.3-p551/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `block in require'
from /Users/anshulgoyal/.rvm/gems/ruby-1.9.3-p551/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:240:in `load_dependency'
from /Users/anshulgoyal/.rvm/gems/ruby-1.9.3-p551/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `require'
from /Users/anshulgoyal/workspace/adamantium/backend/truckfinder_service/bin/rails:8:in `<top (required)>'
from /Users/anshulgoyal/.rvm/gems/ruby-1.9.3-p551/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:268:in `load'
from /Users/anshulgoyal/.rvm/gems/ruby-1.9.3-p551/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:268:in `block in load'
from /Users/anshulgoyal/.rvm/gems/ruby-1.9.3-p551/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:240:in `load_dependency'
from /Users/anshulgoyal/.rvm/gems/ruby-1.9.3-p551/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:268:in `load'
from /Users/anshulgoyal/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/anshulgoyal/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require'
Also, if anyone can provide some code example where AWS Cloudsearch ruby SDK is being used, that will help.
Thanks, Anshul
It should be query_parser
and not queryParser
.
Here are the docs you should be looking at: http://docs.aws.amazon.com/sdkforruby/api/Aws/CloudSearchDomain/Client.html