if (parent != null && !mappingMd.hasParentField()) { throw new IllegalArgumentException("can't specify parent if no parent field has been configured");
@Override public void writeTo(StreamOutput out) throws IOException { out.writeString(type()); source().writeTo(out); // routing out.writeBoolean(routing().required()); if (out.getVersion().before(Version.V_6_0_0_alpha1)) { // timestamp out.writeBoolean(false); // enabled out.writeString(DateFieldMapper.DEFAULT_DATE_TIME_FORMATTER.pattern()); out.writeOptionalString("now"); // 5.x default out.writeOptionalBoolean(null); } out.writeBoolean(hasParentField()); }
public void process(Version indexCreatedVersion, @Nullable MappingMetaData mappingMd, String concreteIndex) { if (mappingMd != null) { // might as well check for routing here if (mappingMd.routing().required() && routing == null) { throw new RoutingMissingException(concreteIndex, type, id); } if (parent != null && !mappingMd.hasParentField()) { throw new IllegalArgumentException("can't specify parent if no parent field has been configured"); } } else { if (parent != null) { throw new IllegalArgumentException("can't specify parent if no parent field has been configured"); } } if ("".equals(id)) { throw new IllegalArgumentException("if _id is specified it must not be empty"); } // generate id if not already provided if (id == null) { assert autoGeneratedTimestamp == -1 : "timestamp has already been generated!"; autoGeneratedTimestamp = Math.max(0, System.currentTimeMillis()); // extra paranoia String uid; if (indexCreatedVersion.onOrAfter(Version.V_6_0_0_beta1)) { uid = UUIDs.base64UUID(); } else { uid = UUIDs.legacyBase64UUID(); } id(uid); } }
public void process(Version indexCreatedVersion, @Nullable MappingMetaData mappingMd, String concreteIndex) { if (mappingMd != null) { // might as well check for routing here if (mappingMd.routing().required() && routing == null) { throw new RoutingMissingException(concreteIndex, type, id); } if (parent != null && !mappingMd.hasParentField()) { throw new IllegalArgumentException("can't specify parent if no parent field has been configured"); } } else { if (parent != null) { throw new IllegalArgumentException("can't specify parent if no parent field has been configured"); } } if ("".equals(id)) { throw new IllegalArgumentException("if _id is specified it must not be empty"); } // generate id if not already provided if (id == null) { assert autoGeneratedTimestamp == -1 : "timestamp has already been generated!"; autoGeneratedTimestamp = Math.max(0, System.currentTimeMillis()); // extra paranoia String uid; if (indexCreatedVersion.onOrAfter(Version.V_6_0_0_beta1)) { uid = UUIDs.base64UUID(); } else { uid = UUIDs.legacyBase64UUID(); } id(uid); } }
if (parent != null && !mappingMd.hasParentField()) { throw new IllegalArgumentException("can't specify parent if no parent field has been configured");
if (mappingMetaData.hasParentField()) { Map<String,Object> parentsProps = (Map<String,Object>)mappingMap.get(ParentFieldMapper.NAME); String pkColumns = (String)parentsProps.get(ParentFieldMapper.CQL_PARENT_PK);
@Override public void writeTo(StreamOutput out) throws IOException { out.writeString(type()); source().writeTo(out); // routing out.writeBoolean(routing().required()); if (out.getVersion().before(Version.V_6_0_0_alpha1)) { // timestamp out.writeBoolean(false); // enabled out.writeString(DateFieldMapper.DEFAULT_DATE_TIME_FORMATTER.format()); out.writeOptionalString("now"); // 5.x default out.writeOptionalBoolean(null); } out.writeBoolean(hasParentField()); }
@Override public void writeTo(StreamOutput out) throws IOException { out.writeString(type()); source().writeTo(out); // routing out.writeBoolean(routing().required()); if (out.getVersion().before(Version.V_6_0_0_alpha1)) { // timestamp out.writeBoolean(false); // enabled out.writeString(DateFieldMapper.DEFAULT_DATE_TIME_FORMATTER.format()); out.writeOptionalString("now"); // 5.x default out.writeOptionalBoolean(null); } out.writeBoolean(hasParentField()); }
@Override public void writeTo(StreamOutput out) throws IOException { out.writeString(type()); source().writeTo(out); // routing out.writeBoolean(routing().required()); // timestamp out.writeBoolean(timestamp().enabled()); out.writeString(timestamp().format()); out.writeOptionalString(timestamp().defaultTimestamp()); out.writeOptionalBoolean(timestamp().ignoreMissing()); out.writeBoolean(hasParentField()); }
if (parent != null && !mappingMd.hasParentField()) { throw new IllegalArgumentException("Can't specify parent if no parent field has been configured");
@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()); }