Class: AliyunOpenSearch::Scan
- Defined in:
- lib/aliyun_open_search/scan.rb
Instance Attribute Summary collapse
-
#custom_params ⇒ Object
readonly
Returns the value of attribute custom_params.
-
#request_id ⇒ Object
readonly
Returns the value of attribute request_id.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
-
#scroll_id ⇒ Object
readonly
Returns the value of attribute scroll_id.
Attributes inherited from Base
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(index_names, options = {}) ⇒ Scan
constructor
A new instance of Scan.
- #setup ⇒ Object
Methods inherited from Base
basic_params, escape, format_params, signature, signature_nonce, #uri
Constructor Details
#initialize(index_names, options = {}) ⇒ Scan
Returns a new instance of Scan.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/aliyun_open_search/scan.rb', line 5 def initialize(index_names, = {}) super() @index_names = index_names.is_a?(Array) ? index_names.join(";") : index_names @scroll = [:scroll] || "1m" @custom_params = { query: [ [:query] || "query=''", "config=hit:#{[:hit] || 500},format:#{[:format] || "json"}" ] } setup end |
Instance Attribute Details
#custom_params ⇒ Object (readonly)
Returns the value of attribute custom_params.
3 4 5 |
# File 'lib/aliyun_open_search/scan.rb', line 3 def custom_params @custom_params end |
#request_id ⇒ Object (readonly)
Returns the value of attribute request_id.
3 4 5 |
# File 'lib/aliyun_open_search/scan.rb', line 3 def request_id @request_id end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
3 4 5 |
# File 'lib/aliyun_open_search/scan.rb', line 3 def result @result end |
#scroll_id ⇒ Object (readonly)
Returns the value of attribute scroll_id.
3 4 5 |
# File 'lib/aliyun_open_search/scan.rb', line 3 def scroll_id @scroll_id end |
Instance Method Details
#execute ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/aliyun_open_search/scan.rb', line 35 def execute params = Base.new.basic_params.merge( Base.format_params( custom_params.merge( "index_name" => @index_names, "scroll" => @scroll, "scroll_id" => @scroll_id ) ) ) send_request(params) end |
#setup ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/aliyun_open_search/scan.rb', line 21 def setup params = basic_params.merge( Base.format_params( custom_params.merge( "index_name" => @index_names, "scroll" => @scroll, "search_type" => "scan" ) ) ) send_request(params) end |