From 137007257a4b28e7181d453bed5f11bffdbcb598 Mon Sep 17 00:00:00 2001 From: Matthew Bargar Date: Thu, 14 Jul 2016 14:15:23 -0400 Subject: [PATCH] Restore _source fetching behavior 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 #7699 Former-commit-id: 1cd6eec7cc83e75d938970fe0f317dca9548ee16 --- src/ui/public/courier/data_source/_abstract.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ui/public/courier/data_source/_abstract.js b/src/ui/public/courier/data_source/_abstract.js index 16b1f2e4a2e37..f2b4eab941af0 100644 --- a/src/ui/public/courier/data_source/_abstract.js +++ b/src/ui/public/courier/data_source/_abstract.js @@ -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 || [];