@@ -65,6 +65,8 @@ public class TermVectorsRequest extends SingleShardRequest<TermVectorsRequest> i
65
65
66
66
private String routing ;
67
67
68
+ private String parent ;
69
+
68
70
private VersionType versionType = VersionType .INTERNAL ;
69
71
70
72
private long version = Versions .MATCH_ANY ;
@@ -162,6 +164,7 @@ public TermVectorsRequest(TermVectorsRequest other) {
162
164
this .flagsEnum = other .getFlags ().clone ();
163
165
this .preference = other .preference ();
164
166
this .routing = other .routing ();
167
+ this .parent = other .parent ();
165
168
if (other .selectedFields != null ) {
166
169
this .selectedFields = new HashSet <>(other .selectedFields );
167
170
}
@@ -181,6 +184,7 @@ public TermVectorsRequest(MultiGetRequest.Item item) {
181
184
this .type = item .type ();
182
185
this .selectedFields (item .fields ());
183
186
this .routing (item .routing ());
187
+ this .parent (item .parent ());
184
188
}
185
189
186
190
public EnumSet <Flag > getFlags () {
@@ -259,14 +263,16 @@ public TermVectorsRequest routing(String routing) {
259
263
return this ;
260
264
}
261
265
266
+ @ Override
267
+ public String parent () {
268
+ return parent ;
269
+ }
270
+
262
271
/**
263
- * Sets the parent id of this document. Will simply set the routing to this
264
- * value, as it is only used for routing with delete requests.
272
+ * Sets the parent id of this document.
265
273
*/
266
274
public TermVectorsRequest parent (String parent ) {
267
- if (routing == null ) {
268
- routing = parent ;
269
- }
275
+ this .parent = parent ;
270
276
return this ;
271
277
}
272
278
@@ -506,6 +512,7 @@ public void readFrom(StreamInput in) throws IOException {
506
512
doc = in .readBytesReference ();
507
513
}
508
514
routing = in .readOptionalString ();
515
+ parent = in .readOptionalString ();
509
516
preference = in .readOptionalString ();
510
517
long flags = in .readVLong ();
511
518
@@ -545,6 +552,7 @@ public void writeTo(StreamOutput out) throws IOException {
545
552
out .writeBytesReference (doc );
546
553
}
547
554
out .writeOptionalString (routing );
555
+ out .writeOptionalString (parent );
548
556
out .writeOptionalString (preference );
549
557
long longFlags = 0 ;
550
558
for (Flag flag : flagsEnum ) {
@@ -629,6 +637,8 @@ public static void parseRequest(TermVectorsRequest termVectorsRequest, XContentP
629
637
termVectorsRequest .doc (jsonBuilder ().copyCurrentStructure (parser ));
630
638
} else if ("_routing" .equals (currentFieldName ) || "routing" .equals (currentFieldName )) {
631
639
termVectorsRequest .routing = parser .text ();
640
+ } else if ("_parent" .equals (currentFieldName ) || "parent" .equals (currentFieldName )) {
641
+ termVectorsRequest .parent = parser .text ();
632
642
} else if ("_version" .equals (currentFieldName ) || "version" .equals (currentFieldName )) {
633
643
termVectorsRequest .version = parser .longValue ();
634
644
} else if ("_version_type" .equals (currentFieldName ) || "_versionType" .equals (currentFieldName ) || "version_type" .equals (currentFieldName ) || "versionType" .equals (currentFieldName )) {
0 commit comments