io.searchbox.core.ClearScroll Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jest-common Show documentation
Show all versions of jest-common Show documentation
ElasticSearch Java REST client - shared library package
package io.searchbox.core;
import com.google.common.collect.ImmutableMap;
import io.searchbox.action.GenericResultAbstractAction;
import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.Set;
public class ClearScroll extends GenericResultAbstractAction {
private final String uri;
public ClearScroll(Builder builder) {
if (builder.getScrollIds().size() == 0) {
uri = "/_search/scroll/_all";
this.payload = null;
} else {
uri = "/_search/scroll";
this.payload = ImmutableMap.of("scroll_id", builder.getScrollIds());
}
setURI(buildURI());
}
@Override
public String getRestMethodName() {
return "DELETE";
}
@Override
protected String buildURI() {
return super.buildURI() + uri;
}
public static class Builder extends GenericResultAbstractAction.Builder {
protected Collection scrollIds = new LinkedHashSet();
public Builder addScrollId(String scrollId) {
this.scrollIds.add(scrollId);
return this;
}
public Builder addScrollIds(Set scrollIds) {
this.scrollIds.addAll(scrollIds);
return this;
}
@Override
public ClearScroll build() {
return new ClearScroll(this);
}
public Collection getScrollIds() {
return scrollIds;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy