@@ -14,43 +14,43 @@ final class SearchRequest implements Arrayable
14
14
public function __construct (?array $ query = null )
15
15
{
16
16
if (isset ($ query )) {
17
- $ this ->request ['query ' ] = $ query ;
17
+ $ this ->request ['body ' ][ ' query ' ] = $ query ;
18
18
}
19
19
}
20
20
21
21
public function highlight (array $ highlight ): self
22
22
{
23
- $ this ->request ['highlight ' ] = $ highlight ;
23
+ $ this ->request ['body ' ][ ' highlight ' ] = $ highlight ;
24
24
return $ this ;
25
25
}
26
26
27
27
public function sort (array $ sort ): self
28
28
{
29
- $ this ->request ['sort ' ] = $ sort ;
29
+ $ this ->request ['body ' ][ ' sort ' ] = $ sort ;
30
30
return $ this ;
31
31
}
32
32
33
33
public function rescore (array $ rescore ): self
34
34
{
35
- $ this ->request ['rescore ' ] = $ rescore ;
35
+ $ this ->request ['body ' ][ ' rescore ' ] = $ rescore ;
36
36
return $ this ;
37
37
}
38
38
39
39
public function from (int $ from ): self
40
40
{
41
- $ this ->request ['from ' ] = $ from ;
41
+ $ this ->request ['body ' ][ ' from ' ] = $ from ;
42
42
return $ this ;
43
43
}
44
44
45
45
public function size (int $ size ): self
46
46
{
47
- $ this ->request ['size ' ] = $ size ;
47
+ $ this ->request ['body ' ][ ' size ' ] = $ size ;
48
48
return $ this ;
49
49
}
50
50
51
51
public function suggest (array $ suggest ): self
52
52
{
53
- $ this ->request ['suggest ' ] = $ suggest ;
53
+ $ this ->request ['body ' ][ ' suggest ' ] = $ suggest ;
54
54
return $ this ;
55
55
}
56
56
@@ -59,25 +59,25 @@ public function suggest(array $suggest): self
59
59
*/
60
60
public function source ($ source ): self
61
61
{
62
- $ this ->request ['_source ' ] = $ source ;
62
+ $ this ->request ['body ' ][ ' _source ' ] = $ source ;
63
63
return $ this ;
64
64
}
65
65
66
66
public function collapse (array $ collapse ): self
67
67
{
68
- $ this ->request ['collapse ' ] = $ collapse ;
68
+ $ this ->request ['body ' ][ ' collapse ' ] = $ collapse ;
69
69
return $ this ;
70
70
}
71
71
72
72
public function aggregations (array $ aggregations ): self
73
73
{
74
- $ this ->request ['aggregations ' ] = $ aggregations ;
74
+ $ this ->request ['body ' ][ ' aggregations ' ] = $ aggregations ;
75
75
return $ this ;
76
76
}
77
77
78
78
public function postFilter (array $ postFilter ): self
79
79
{
80
- $ this ->request ['post_filter ' ] = $ postFilter ;
80
+ $ this ->request ['body ' ][ ' post_filter ' ] = $ postFilter ;
81
81
return $ this ;
82
82
}
83
83
@@ -86,31 +86,43 @@ public function postFilter(array $postFilter): self
86
86
*/
87
87
public function trackTotalHits ($ trackTotalHits ): self
88
88
{
89
- $ this ->request ['track_total_hits ' ] = $ trackTotalHits ;
89
+ $ this ->request ['body ' ][ ' track_total_hits ' ] = $ trackTotalHits ;
90
90
return $ this ;
91
91
}
92
92
93
93
public function indicesBoost (array $ indicesBoost ): self
94
94
{
95
- $ this ->request ['indices_boost ' ] = $ indicesBoost ;
95
+ $ this ->request ['body ' ][ ' indices_boost ' ] = $ indicesBoost ;
96
96
return $ this ;
97
97
}
98
98
99
99
public function trackScores (bool $ trackScores ): self
100
100
{
101
- $ this ->request ['track_scores ' ] = $ trackScores ;
101
+ $ this ->request ['body ' ][ ' track_scores ' ] = $ trackScores ;
102
102
return $ this ;
103
103
}
104
104
105
105
public function minScore (float $ minScore ): self
106
106
{
107
- $ this ->request ['min_score ' ] = $ minScore ;
107
+ $ this ->request ['body ' ][ ' min_score ' ] = $ minScore ;
108
108
return $ this ;
109
109
}
110
110
111
111
public function scriptFields (array $ scriptFields ): self
112
112
{
113
- $ this ->request ['script_fields ' ] = $ scriptFields ;
113
+ $ this ->request ['body ' ]['script_fields ' ] = $ scriptFields ;
114
+ return $ this ;
115
+ }
116
+
117
+ public function searchType (string $ searchType ): self
118
+ {
119
+ $ this ->request ['search_type ' ] = $ searchType ;
120
+ return $ this ;
121
+ }
122
+
123
+ public function preference (string $ preference ): self
124
+ {
125
+ $ this ->request ['preference ' ] = $ preference ;
114
126
return $ this ;
115
127
}
116
128
0 commit comments