Method: Chewy::Search::Request#script_fields

Defined in:
lib/chewy/search/request.rb

#script_fields(value) ⇒ Chewy::Search::Request

Add a script_fields part to the request. Further call values are merged to the storage hash.

Examples:

PlacesIndex
  .script_fields(field1: {script: {lang: 'painless', inline: 'some script here'}})
  .script_fields(field2: {script: {lang: 'painless', inline: 'some script here'}})
# => <PlacesIndex::Query {..., :body=>{:script_fields=>{
#      "field1"=>{:script=>{:lang=>"painless", :inline=>"some script here"}},
#      "field2"=>{:script=>{:lang=>"painless", :inline=>"some script here"}}}}}>

Parameters:

  • value (Hash)

Returns:

See Also:



659
660
661
662
663
# File 'lib/chewy/search/request.rb', line 659

i[script_fields indices_boost rescore highlight].each do |name|
  define_method name do |value|
    modify(name) { update!(value) }
  end
end