void updateDefaultMapping(MappingMetaData defaultMapping) { if (id == Id.EMPTY) { id = defaultMapping.id(); } if (routing == Routing.EMPTY) { routing = defaultMapping.routing(); } if (timestamp == Timestamp.EMPTY) { timestamp = defaultMapping.timestamp(); } }
public ParseContext createParseContext(@Nullable String id, @Nullable String routing, @Nullable String timestamp) { // We parse the routing even if there is already a routing key in the request in order to make sure that // they are the same return new ParseContext( id == null && id().hasPath(), routing().hasPath(), timestamp == null && timestamp().hasPath() ); }
token = parser.nextToken(); String idPart = context.idParsingStillNeeded() ? id().pathElements()[context.locationId] : null; String routingPart = context.routingParsingStillNeeded() ? routing().pathElements()[context.locationRouting] : null; String timestampPart = context.timestampParsingStillNeeded() ? timestamp().pathElements()[context.locationTimestamp] : null;
@Override public void writeTo(StreamOutput out) throws IOException { out.writeString(type()); source().writeTo(out); // id if (id().hasPath()) { out.writeBoolean(true); out.writeString(id().path()); } else { out.writeBoolean(false); } // routing out.writeBoolean(routing().required()); if (routing().hasPath()) { out.writeBoolean(true); out.writeString(routing().path()); } else { out.writeBoolean(false); } // timestamp out.writeBoolean(timestamp().enabled()); out.writeOptionalString(timestamp().path()); out.writeString(timestamp().format()); out.writeOptionalString(timestamp().defaultTimestamp()); out.writeOptionalBoolean(timestamp().ignoreMissing()); out.writeBoolean(hasParentField()); }