@@ -64,7 +64,7 @@ public class HasParentQueryBuilder extends AbstractQueryBuilder<HasParentQueryBu
64
64
public static final boolean DEFAULT_IGNORE_UNMAPPED = false ;
65
65
66
66
private static final ParseField QUERY_FIELD = new ParseField ("query" );
67
- private static final ParseField TYPE_FIELD = new ParseField ("parent_type" );
67
+ private static final ParseField PARENT_TYPE_FIELD = new ParseField ("parent_type" );
68
68
private static final ParseField SCORE_FIELD = new ParseField ("score" );
69
69
private static final ParseField INNER_HITS_FIELD = new ParseField ("inner_hits" );
70
70
private static final ParseField IGNORE_UNMAPPED_FIELD = new ParseField ("ignore_unmapped" );
@@ -80,8 +80,8 @@ public HasParentQueryBuilder(String type, QueryBuilder query, boolean score) {
80
80
}
81
81
82
82
private HasParentQueryBuilder (String type , QueryBuilder query , boolean score , InnerHitBuilder innerHitBuilder ) {
83
- this .type = requireValue (type , "[" + NAME + "] requires 'type ' field" );
84
- this .query = requireValue (query , "[" + NAME + "] requires 'query ' field" );
83
+ this .type = requireValue (type , "[" + NAME + "] requires '" + PARENT_TYPE_FIELD . getPreferredName () + " ' field" );
84
+ this .query = requireValue (query , "[" + NAME + "] requires '" + QUERY_FIELD . getPreferredName () + " ' field" );
85
85
this .score = score ;
86
86
this .innerHitBuilder = innerHitBuilder ;
87
87
}
@@ -274,7 +274,7 @@ protected void doXContent(XContentBuilder builder, Params params) throws IOExcep
274
274
builder .startObject (NAME );
275
275
builder .field (QUERY_FIELD .getPreferredName ());
276
276
query .toXContent (builder , params );
277
- builder .field (TYPE_FIELD .getPreferredName (), type );
277
+ builder .field (PARENT_TYPE_FIELD .getPreferredName (), type );
278
278
builder .field (SCORE_FIELD .getPreferredName (), score );
279
279
builder .field (IGNORE_UNMAPPED_FIELD .getPreferredName (), ignoreUnmapped );
280
280
printBoostAndQueryName (builder );
@@ -308,7 +308,7 @@ public static HasParentQueryBuilder fromXContent(XContentParser parser) throws I
308
308
"[has_parent] query does not support [" + currentFieldName + "]" );
309
309
}
310
310
} else if (token .isValue ()) {
311
- if (TYPE_FIELD .match (currentFieldName , parser .getDeprecationHandler ())) {
311
+ if (PARENT_TYPE_FIELD .match (currentFieldName , parser .getDeprecationHandler ())) {
312
312
parentType = parser .text ();
313
313
} else if (SCORE_FIELD .match (currentFieldName , parser .getDeprecationHandler ())) {
314
314
score = parser .booleanValue ();
0 commit comments