Skip to content

Rename fields to stored_fields and add docvalue_fields #18992

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ public SearchRequestBuilder setStats(List<String> statsGroups) {
/**
* Sets no fields to be loaded, resulting in only id and type to be returned per field.
*/
public SearchRequestBuilder setNoFields() {
sourceBuilder().noFields();
public SearchRequestBuilder setNoStoredFields() {
sourceBuilder().noStoredFields();
return this;
}

Expand Down Expand Up @@ -290,13 +290,23 @@ public SearchRequestBuilder setFetchSource(@Nullable String[] includes, @Nullabl
return this;
}

/**
* Adds a docvalue based field to load and return. The field does not have to be stored,
* but its recommended to use non analyzed or numeric fields.
*
* @param name The field to get from the docvalue
*/
public SearchRequestBuilder addDocValueField(String name) {
sourceBuilder().docValueField(name);
return this;
}

/**
* Adds a field to load and return (note, it must be stored) as part of the search request.
* Adds a stored field to load and return (note, it must be stored) as part of the search request.
* If none are specified, the source of the document will be return.
*/
public SearchRequestBuilder addField(String field) {
sourceBuilder().field(field);
public SearchRequestBuilder addStoredField(String field) {
sourceBuilder().storedField(field);
return this;
}

Expand All @@ -305,12 +315,15 @@ public SearchRequestBuilder addField(String field) {
* but its recommended to use non analyzed or numeric fields.
*
* @param name The field to get from the field data cache
* @deprecated Use {@link SearchRequestBuilder#addDocValueField(String)} instead.
*/
@Deprecated
public SearchRequestBuilder addFieldDataField(String name) {
sourceBuilder().fieldDataField(name);
sourceBuilder().docValueField(name);
return this;
}


/**
* Adds a script based field to load and return. The field does not have to be stored,
* but its recommended to use non analyzed or numeric fields.
Expand Down Expand Up @@ -368,11 +381,23 @@ public SearchRequestBuilder setTrackScores(boolean trackScores) {
}

/**
* Sets the fields to load and return as part of the search request. If none
* Sets the stored fields to load and return as part of the search request. If none
* are specified, the source of the document will be returned.
*
* @deprecated Use {@link SearchRequestBuilder#storedFields(String...)} instead.
*/
@Deprecated
public SearchRequestBuilder fields(String... fields) {
sourceBuilder().fields(Arrays.asList(fields));
sourceBuilder().storedFields(Arrays.asList(fields));
return this;
}

/**
* Sets the fields to load and return as part of the search request. If none
* are specified, the source of the document will be returned.
*/
public SearchRequestBuilder storedFields(String... fields) {
sourceBuilder().storedFields(Arrays.asList(fields));
return this;
}

Expand Down
Loading