32
32
33
33
package org .opensearch .action .admin .indices .validate .query ;
34
34
35
+ import org .opensearch .Version ;
35
36
import org .opensearch .action .ActionRequestValidationException ;
36
37
import org .opensearch .action .ValidateActions ;
37
38
import org .opensearch .action .support .IndicesOptions ;
@@ -60,8 +61,6 @@ public class ValidateQueryRequest extends BroadcastRequest<ValidateQueryRequest>
60
61
private boolean rewrite ;
61
62
private boolean allShards ;
62
63
63
- private String [] types = Strings .EMPTY_ARRAY ;
64
-
65
64
long nowInMillis ;
66
65
67
66
public ValidateQueryRequest () {
@@ -71,11 +70,12 @@ public ValidateQueryRequest() {
71
70
public ValidateQueryRequest (StreamInput in ) throws IOException {
72
71
super (in );
73
72
query = in .readNamedWriteable (QueryBuilder .class );
74
- int typesSize = in .readVInt ();
75
- if (typesSize > 0 ) {
76
- types = new String [typesSize ];
77
- for (int i = 0 ; i < typesSize ; i ++) {
78
- types [i ] = in .readString ();
73
+ if (in .getVersion ().before (Version .V_2_0_0 )) {
74
+ int typesSize = in .readVInt ();
75
+ if (typesSize > 0 ) {
76
+ for (int i = 0 ; i < typesSize ; i ++) {
77
+ in .readString ();
78
+ }
79
79
}
80
80
}
81
81
explain = in .readBoolean ();
@@ -113,29 +113,6 @@ public ValidateQueryRequest query(QueryBuilder query) {
113
113
return this ;
114
114
}
115
115
116
- /**
117
- * The types of documents the query will run against. Defaults to all types.
118
- *
119
- * @deprecated Types are in the process of being removed. Instead of using a type, prefer to
120
- * filter on a field on the document.
121
- */
122
- @ Deprecated
123
- public String [] types () {
124
- return this .types ;
125
- }
126
-
127
- /**
128
- * The types of documents the query will run against. Defaults to all types.
129
- *
130
- * @deprecated Types are in the process of being removed. Instead of using a type, prefer to
131
- * filter on a field on the document.
132
- */
133
- @ Deprecated
134
- public ValidateQueryRequest types (String ... types ) {
135
- this .types = types ;
136
- return this ;
137
- }
138
-
139
116
/**
140
117
* Indicate if detailed information about query is requested
141
118
*/
@@ -182,9 +159,8 @@ public boolean allShards() {
182
159
public void writeTo (StreamOutput out ) throws IOException {
183
160
super .writeTo (out );
184
161
out .writeNamedWriteable (query );
185
- out .writeVInt (types .length );
186
- for (String type : types ) {
187
- out .writeString (type );
162
+ if (out .getVersion ().before (Version .V_2_0_0 )) {
163
+ out .writeVInt (0 ); // no types to filter
188
164
}
189
165
out .writeBoolean (explain );
190
166
out .writeBoolean (rewrite );
@@ -196,8 +172,7 @@ public String toString() {
196
172
return "["
197
173
+ Arrays .toString (indices )
198
174
+ "]"
199
- + Arrays .toString (types )
200
- + ", query["
175
+ + " query["
201
176
+ query
202
177
+ "], explain:"
203
178
+ explain
0 commit comments