@@ -58,7 +58,7 @@ public class HasParentQueryBuilder extends AbstractQueryBuilder<HasParentQueryBu
58
58
public static final boolean DEFAULT_IGNORE_UNMAPPED = false ;
59
59
60
60
private static final ParseField QUERY_FIELD = new ParseField ("query" );
61
- private static final ParseField TYPE_FIELD = new ParseField ("parent_type" );
61
+ private static final ParseField PARENT_TYPE_FIELD = new ParseField ("parent_type" );
62
62
private static final ParseField SCORE_FIELD = new ParseField ("score" );
63
63
private static final ParseField INNER_HITS_FIELD = new ParseField ("inner_hits" );
64
64
private static final ParseField IGNORE_UNMAPPED_FIELD = new ParseField ("ignore_unmapped" );
@@ -74,8 +74,8 @@ public HasParentQueryBuilder(String type, QueryBuilder query, boolean score) {
74
74
}
75
75
76
76
private HasParentQueryBuilder (String type , QueryBuilder query , boolean score , InnerHitBuilder innerHitBuilder ) {
77
- this .type = requireValue (type , "[" + NAME + "] requires 'type ' field" );
78
- this .query = requireValue (query , "[" + NAME + "] requires 'query ' field" );
77
+ this .type = requireValue (type , "[" + NAME + "] requires '" + PARENT_TYPE_FIELD . getPreferredName () + " ' field" );
78
+ this .query = requireValue (query , "[" + NAME + "] requires '" + QUERY_FIELD . getPreferredName () + " ' field" );
79
79
this .score = score ;
80
80
this .innerHitBuilder = innerHitBuilder ;
81
81
}
@@ -201,7 +201,7 @@ protected void doXContent(XContentBuilder builder, Params params) throws IOExcep
201
201
builder .startObject (NAME );
202
202
builder .field (QUERY_FIELD .getPreferredName ());
203
203
query .toXContent (builder , params );
204
- builder .field (TYPE_FIELD .getPreferredName (), type );
204
+ builder .field (PARENT_TYPE_FIELD .getPreferredName (), type );
205
205
builder .field (SCORE_FIELD .getPreferredName (), score );
206
206
builder .field (IGNORE_UNMAPPED_FIELD .getPreferredName (), ignoreUnmapped );
207
207
printBoostAndQueryName (builder );
@@ -235,7 +235,7 @@ public static HasParentQueryBuilder fromXContent(XContentParser parser) throws I
235
235
"[has_parent] query does not support [" + currentFieldName + "]" );
236
236
}
237
237
} else if (token .isValue ()) {
238
- if (TYPE_FIELD .match (currentFieldName , parser .getDeprecationHandler ())) {
238
+ if (PARENT_TYPE_FIELD .match (currentFieldName , parser .getDeprecationHandler ())) {
239
239
parentType = parser .text ();
240
240
} else if (SCORE_FIELD .match (currentFieldName , parser .getDeprecationHandler ())) {
241
241
score = parser .booleanValue ();
0 commit comments