Skip to content

Commit

Permalink
Merge pull request #13 from rahul1193/rahul/rest-client-1.4.1
Browse files Browse the repository at this point in the history
support for requesting cache on script in rest client
  • Loading branch information
brandonkearby committed Jan 27, 2017
2 parents 80db68a + 955bd82 commit 38174b5
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>1.4.1-rest-1.0.36</version>
<version>1.4.1-rest-1.0.37</version>
<packaging>jar</packaging>
<description>Elasticsearch - Open Source, Distributed, RESTful Search Engine</description>
<inceptionYear>2009</inceptionYear>
Expand Down
Expand Up @@ -118,6 +118,10 @@ protected void doXContent(XContentBuilder builder, Params params) throws IOExcep
builder.field("params", this.params);
}

if (this.cache != null) {
builder.field("_cache", this.cache);
}

builder.endObject();

builder.endObject();
Expand Down
Expand Up @@ -37,6 +37,11 @@ public abstract class ValuesSourceAggregationBuilder<B extends ValuesSourceAggre
private String lang;
private Map<String, Object> params;

/**
* request cache for script
*/
private Boolean requestCache;

/**
* Constructs a new builder.
*
Expand Down Expand Up @@ -119,6 +124,12 @@ public B params(Map<String, Object> params) {
return (B) this;
}

@SuppressWarnings("unchecked")
public B requestCache(boolean requestCache) {
this.requestCache = requestCache;
return (B) this;
}

@Override
protected final XContentBuilder internalXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject();
Expand All @@ -136,6 +147,9 @@ protected final XContentBuilder internalXContent(XContentBuilder builder, Params
if (this.params != null && !this.params.isEmpty()) {
builder.field("params").map(this.params);
}
if (this.requestCache != null) {
builder.field("_cache", this.requestCache);
}
builder.endObject();
}
} else {
Expand Down
Expand Up @@ -37,6 +37,11 @@ public abstract class ValuesSourceMetricsAggregationBuilder<B extends ValuesSour
private String lang;
private Map<String, Object> params;

/**
* request cache for script
*/
private Boolean requestCache;

protected ValuesSourceMetricsAggregationBuilder(String name, String type) {
super(name, type);
}
Expand Down Expand Up @@ -78,6 +83,11 @@ public B param(String name, Object value) {
return (B) this;
}

public B requestCache(boolean requestCache){
this.requestCache = requestCache;
return (B) this;
}

@Override
protected void internalXContent(XContentBuilder builder, Params params) throws IOException {
if (field != null) {
Expand All @@ -94,6 +104,9 @@ protected void internalXContent(XContentBuilder builder, Params params) throws I
if (this.params != null && !this.params.isEmpty()) {
builder.field("params").map(this.params);
}
if (this.requestCache != null) {
builder.field("_cache", this.requestCache);
}
builder.endObject();
}

Expand Down

0 comments on commit 38174b5

Please sign in to comment.