public SpanQuery getSpanQuery(Element e) throws ParserException {
   SpanQueryBuilder builder = builders.get(e.getNodeName());
   if (builder == null) {
     throw new ParserException("No SpanQueryObjectBuilder defined for node " + e.getNodeName());
   }
   return builder.getSpanQuery(e);
 }
 @Override
 protected Query doToQuery(QueryShardContext context) throws IOException {
   Query innerBig = big.toQuery(context);
   assert innerBig instanceof SpanQuery;
   Query innerLittle = little.toQuery(context);
   assert innerLittle instanceof SpanQuery;
   return new SpanWithinQuery((SpanQuery) innerBig, (SpanQuery) innerLittle);
 }
 @Override
 protected void doXContent(XContentBuilder builder, Params params) throws IOException {
   builder.startObject(NAME);
   builder.startArray(CLAUSES_FIELD.getPreferredName());
   for (SpanQueryBuilder<?> clause : clauses) {
     clause.toXContent(builder, params);
   }
   builder.endArray();
   builder.field(SLOP_FIELD.getPreferredName(), slop);
   builder.field(IN_ORDER_FIELD.getPreferredName(), inOrder);
   printBoostAndQueryName(builder);
   builder.endObject();
 }
  @Override
  protected void doXContent(XContentBuilder builder, Params params) throws IOException {
    builder.startObject(NAME);

    builder.field(BIG_FIELD.getPreferredName());
    big.toXContent(builder, params);

    builder.field(LITTLE_FIELD.getPreferredName());
    little.toXContent(builder, params);

    printBoostAndQueryName(builder);

    builder.endObject();
  }
 @Override
 protected void doXContent(XContentBuilder builder, Params params) throws IOException {
   builder.startObject(NAME);
   builder.field(QUERY_FIELD.getPreferredName());
   queryBuilder.toXContent(builder, params);
   builder.field(FIELD_FIELD.getPreferredName(), fieldName);
   printBoostAndQueryName(builder);
   builder.endObject();
 }
 @Override
 protected SpanQuery doToQuery(QueryShardContext context) throws IOException {
   String fieldInQuery = fieldName;
   MappedFieldType fieldType = context.fieldMapper(fieldName);
   if (fieldType != null) {
     fieldInQuery = fieldType.name();
   }
   Query innerQuery = queryBuilder.toQuery(context);
   assert innerQuery instanceof SpanQuery;
   return new FieldMaskingSpanQuery((SpanQuery) innerQuery, fieldInQuery);
 }