Question

My query is this

q = '{ "script":"ctx._source.id = val", "params":{ "val":11316623} }'
   _id="11316623"
   response = JSON.parse(RestClient.post("http://mydomain:9200/monitoring/mention_reports/#{_id}/_delete", q))

it gives us

/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.7/lib/restclient/abstract_response.rb:48:in `return!': 400 Bad Request (RestClient::BadRequest)
    from /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.7/lib/restclient/request.rb:230:in `process_result'
    from /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.7/lib/restclient/request.rb:178:in `transmit'
    from /usr/lib/ruby/1.8/net/http.rb:543:in `start'
    from /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.7/lib/restclient/request.rb:172:in `transmit'
    from /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.7/lib/restclient/request.rb:64:in `execute'

    from /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.7/lib/restclient/request.rb:33:in `execute'

from /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.7/lib/restclient.rb:72:in `post'

Please help me

Was it helpful?

Solution

Please do in this way

 mydomain = "ec2-222-333-444-244.us-west-1.compute.amazonaws.com"
 q= '{ "script":"ctx._source.id = val", "params":{ "val":11316623} }'
 _id = "11316623"
 response = RestClient.post "http://#{mydomain}/monitoring/mention_reports/#{_id}/_delete", :q => q, :content_type => :json, :accept => :json
 json_res = JSON.parse(response) 

it should be

RestClient.post 'http://example.com/resource', :param1 => 'one', :nested => { :param2 => 'two' } in this format

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top