/** * Parse the string representation of a refresh policy, usually from a request parameter. */ public static RefreshPolicy parse(String value) { for (RefreshPolicy policy : values()) { if (policy.getValue().equals(value)) { return policy; } } if ("".equals(value)) { // Empty string is IMMEDIATE because that makes "POST /test/test/1?refresh" perform // a refresh which reads well and is what folks are used to. return IMMEDIATE; } throw new IllegalArgumentException("Unknown value for refresh: [" + value + "]."); }
@Override public void readFrom(StreamInput in) throws IOException { super.readFrom(in); waitForActiveShards = ActiveShardCount.readFrom(in); int size = in.readVInt(); for (int i = 0; i < size; i++) { requests.add(DocWriteRequest.readDocumentRequest(in)); } refreshPolicy = RefreshPolicy.readFrom(in); timeout = in.readTimeValue(); }
@Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); waitForActiveShards.writeTo(out); out.writeVInt(requests.size()); for (DocWriteRequest<?> request : requests) { DocWriteRequest.writeDocumentRequest(out, request); } refreshPolicy.writeTo(out); out.writeTimeValue(timeout); }
refreshPolicy.writeTo(out); if (doc == null) { out.writeBoolean(false);
refreshPolicy.writeTo(out); if (doc == null) { out.writeBoolean(false);
refreshPolicy.writeTo(out); if (doc == null) { out.writeBoolean(false);
@Override public void readFrom(StreamInput in) throws IOException { super.readFrom(in); waitForActiveShards = ActiveShardCount.readFrom(in); type = in.readString(); id = in.readString(); routing = in.readOptionalString(); parent = in.readOptionalString(); if (in.readBoolean()) { script = new Script(in); } retryOnConflict = in.readVInt(); refreshPolicy = RefreshPolicy.readFrom(in); if (in.readBoolean()) { doc = new IndexRequest(); doc.readFrom(in); } fields = in.readOptionalStringArray(); fetchSourceContext = in.readOptionalWriteable(FetchSourceContext::new); if (in.readBoolean()) { upsertRequest = new IndexRequest(); upsertRequest.readFrom(in); } docAsUpsert = in.readBoolean(); version = in.readLong(); versionType = VersionType.fromValue(in.readByte()); detectNoop = in.readBoolean(); scriptedUpsert = in.readBoolean(); }
@Override public void readFrom(StreamInput in) throws IOException { super.readFrom(in); waitForActiveShards = ActiveShardCount.readFrom(in); type = in.readString(); id = in.readString(); routing = in.readOptionalString(); parent = in.readOptionalString(); if (in.readBoolean()) { script = new Script(in); } retryOnConflict = in.readVInt(); refreshPolicy = RefreshPolicy.readFrom(in); if (in.readBoolean()) { doc = new IndexRequest(); doc.readFrom(in); } fields = in.readOptionalStringArray(); fetchSourceContext = in.readOptionalWriteable(FetchSourceContext::new); if (in.readBoolean()) { upsertRequest = new IndexRequest(); upsertRequest.readFrom(in); } docAsUpsert = in.readBoolean(); version = in.readLong(); versionType = VersionType.fromValue(in.readByte()); detectNoop = in.readBoolean(); scriptedUpsert = in.readBoolean(); }
@Override public void readFrom(StreamInput in) throws IOException { super.readFrom(in); waitForActiveShards = ActiveShardCount.readFrom(in); type = in.readString(); id = in.readString(); routing = in.readOptionalString(); parent = in.readOptionalString(); if (in.readBoolean()) { script = new Script(in); } retryOnConflict = in.readVInt(); refreshPolicy = RefreshPolicy.readFrom(in); if (in.readBoolean()) { doc = new IndexRequest(); doc.readFrom(in); } fields = in.readOptionalStringArray(); fetchSourceContext = in.readOptionalWriteable(FetchSourceContext::new); if (in.readBoolean()) { upsertRequest = new IndexRequest(); upsertRequest.readFrom(in); } docAsUpsert = in.readBoolean(); version = in.readLong(); versionType = VersionType.fromValue(in.readByte()); detectNoop = in.readBoolean(); scriptedUpsert = in.readBoolean(); }
/** * Parse the string representation of a refresh policy, usually from a request parameter. */ public static RefreshPolicy parse(String value) { for (RefreshPolicy policy : values()) { if (policy.getValue().equals(value)) { return policy; } } if ("".equals(value)) { // Empty string is IMMEDIATE because that makes "POST /test/test/1?refresh" perform // a refresh which reads well and is what folks are used to. return IMMEDIATE; } throw new IllegalArgumentException("Unknown value for refresh: [" + value + "]."); }
public static RefreshPolicy readFrom(StreamInput in) throws IOException { return RefreshPolicy.values()[in.readByte()]; }
/** * Parse the string representation of a refresh policy, usually from a request parameter. */ public static RefreshPolicy parse(String value) { for (RefreshPolicy policy : values()) { if (policy.getValue().equals(value)) { return policy; } } if ("".equals(value)) { // Empty string is IMMEDIATE because that makes "POST /test/test/1?refresh" perform // a refresh which reads well and is what folks are used to. return IMMEDIATE; } throw new IllegalArgumentException("Unknown value for refresh: [" + value + "]."); }
public static RefreshPolicy readFrom(StreamInput in) throws IOException { return RefreshPolicy.values()[in.readByte()]; }
public static RefreshPolicy readFrom(StreamInput in) throws IOException { return RefreshPolicy.values()[in.readByte()]; }
@Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); refreshPolicy.writeTo(out); } }
@Override public void writeTo(StreamOutput out) throws IOException { out.writeByte((byte) ordinal()); } }
/** * Parse the refresh policy from a string, only modifying it if the string is non null. Convenient to use with request parsing. */ @SuppressWarnings("unchecked") default R setRefreshPolicy(String refreshPolicy) { if (refreshPolicy != null) { setRefreshPolicy(RefreshPolicy.parse(refreshPolicy)); } return (R) this; }
@Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); waitForActiveShards.writeTo(out); out.writeVInt(requests.size()); for (DocWriteRequest request : requests) { DocWriteRequest.writeDocumentRequest(out, request); } refreshPolicy.writeTo(out); timeout.writeTo(out); } }
/** * Parse the refresh policy from a string, only modifying it if the string is non null. Convenient to use with request parsing. */ @SuppressWarnings("unchecked") default R setRefreshPolicy(String refreshPolicy) { if (refreshPolicy != null) { setRefreshPolicy(RefreshPolicy.parse(refreshPolicy)); } return (R) this; }
Params withRefreshPolicy(RefreshPolicy refreshPolicy) { if (refreshPolicy != RefreshPolicy.NONE) { return putParam("refresh", refreshPolicy.getValue()); } return this; }