Skip to content

Commit

Permalink
Restore _source fetching behavior
Browse files Browse the repository at this point in the history
Kibana used to always include a `fields` parameter on Discover search
requests which included '_source' so that ES would return the _source
field for each hit. When ES removed the `fields` param we attempted to
switch to a new request body param `_source: true` to maintain the
same behavior. However, we missed one spot in the code that needed
updating in order to pass that param along to the actual request json.

This problem wasn't immediately obvious because _source is included by
default. However, this fixes a related issue where _source fields were
missing in Discover if any scripted fields existed. The presence of the
`script_fields` param in the request would disabled the automatic return
of _source. Now that we're correctly passing `_source: true`, _source
fetching works correctly even when scripted fields are present.

Fixes elastic#7699


Former-commit-id: 1cd6eec
  • Loading branch information
Bargs committed Jul 14, 2016
1 parent fa2749f commit 1370072
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/ui/public/courier/data_source/_abstract.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,8 @@ export default function SourceAbstractFactory(Private, Promise, PromiseEmitter)

if (flatState.body.size > 0) {
let computedFields = flatState.index.getComputedFields();
flatState.body.fields = computedFields.fields;
flatState.body.stored_fields = computedFields.storedFields;
flatState.body._source = computedFields._source;
flatState.body.script_fields = flatState.body.script_fields || {};
flatState.body.fielddata_fields = flatState.body.fielddata_fields || [];

Expand Down

0 comments on commit 1370072

Please sign in to comment.