when setting null value ttl, reset it
This commit is contained in:
parent
e52dbf4fda
commit
a8fc0cbcf3
|
@ -288,15 +288,19 @@ public class IndexRequest extends ShardReplicationOperationRequest {
|
|||
return this.timestamp;
|
||||
}
|
||||
|
||||
// Sets the relative ttl value. It musts be > 0 as it makes little sense otherwise.
|
||||
/**
|
||||
* Sets the relative ttl value. It musts be > 0 as it makes little sense otherwise. Setting it
|
||||
* to <tt>null</tt> will reset to have no ttl.
|
||||
*/
|
||||
public IndexRequest ttl(Long ttl) throws ElasticSearchGenerationException {
|
||||
if (ttl == null) {
|
||||
this.ttl = -1;
|
||||
return this;
|
||||
}
|
||||
if (ttl <= 0) {
|
||||
throw new ElasticSearchIllegalArgumentException("TTL value must be > 0. Illegal value provided [" + ttl + "]");
|
||||
}
|
||||
this.ttl = ttl;
|
||||
this.ttl = ttl;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue