7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/mongoid/elasticsearch/monkeypatches.rb', line 7
def search(arguments={})
arguments[:index] = '_all' if ! arguments[:index] && arguments[:type]
valid_params = [
:analyzer,
:analyze_wildcard,
:default_operator,
:df,
:explain,
:fields,
:from,
:ignore_indices,
:ignore_unavailable,
:allow_no_indices,
:expand_wildcards,
:indices_boost,
:lenient,
:lowercase_expanded_terms,
:preference,
:q,
:routing,
:scroll,
:search_type,
:size,
:sort,
:source,
:_source,
:_source_include,
:_source_exclude,
:stats,
:suggest_field,
:suggest_mode,
:suggest_size,
:suggest_text,
:timeout,
:version ]
method = 'GET'
path = Utils.__pathify( Utils.__listify(arguments[:index]), Utils.__listify(arguments[:type]), '_search' )
params = Utils.__validate_and_extract_params arguments, valid_params
body = arguments[:body]
params[:fields] = Utils.__listify(params[:fields]) if params[:fields]
perform_request(method, path, params, body).body
end
|