From 6aaf31a88466e66e4810f9c63aa708c4f704b75d Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Mon, 15 Aug 2016 21:28:55 -0400 Subject: [PATCH] Use docvalue_fields iso fielddata_fields fielddata_fields is deprecated in 5.0 --- src/core_plugins/console/api_server/es_5_0/aggregations.js | 2 +- src/core_plugins/console/api_server/es_5_0/indices.js | 2 +- src/core_plugins/console/api_server/es_5_0/search.js | 1 - src/core_plugins/elasticsearch/lib/__tests__/routes.js | 2 +- src/core_plugins/kibana/public/doc/controllers/doc.js | 2 +- src/ui/public/courier/data_source/_abstract.js | 4 ++-- .../public/index_patterns/__tests__/_get_computed_fields.js | 6 +++--- src/ui/public/index_patterns/_get_computed_fields.js | 6 +++--- 8 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/core_plugins/console/api_server/es_5_0/aggregations.js b/src/core_plugins/console/api_server/es_5_0/aggregations.js index e9b89dea15e6..5dbd0ee21b8a 100644 --- a/src/core_plugins/console/api_server/es_5_0/aggregations.js +++ b/src/core_plugins/console/api_server/es_5_0/aggregations.js @@ -332,7 +332,7 @@ var rules = { script_fields: { __scope_link: "_search.script_fields" }, - fielddata_fields: ["{field}"], + docvalue_fields: ["{field}"], version: {__one_of: [true, false]} }, "percentile_ranks": { diff --git a/src/core_plugins/console/api_server/es_5_0/indices.js b/src/core_plugins/console/api_server/es_5_0/indices.js index 9e2d31811680..f65ee3d2fcc2 100644 --- a/src/core_plugins/console/api_server/es_5_0/indices.js +++ b/src/core_plugins/console/api_server/es_5_0/indices.js @@ -60,7 +60,7 @@ module.exports = function (api) { "fields": [], "types": [], "completion_fields": [], - "fielddata_fields": [], + "docvalue_fields": [], "level": ["cluster", "indices", "shards"] } diff --git a/src/core_plugins/console/api_server/es_5_0/search.js b/src/core_plugins/console/api_server/es_5_0/search.js index dda530f6e904..db5efcf6b24e 100644 --- a/src/core_plugins/console/api_server/es_5_0/search.js +++ b/src/core_plugins/console/api_server/es_5_0/search.js @@ -121,7 +121,6 @@ module.exports = function (api) { ] }, stored_fields: ['{field}'], - fielddata_fields: ["{field}"], docvalue_fields: ["{field}"], script_fields: { __template: { diff --git a/src/core_plugins/elasticsearch/lib/__tests__/routes.js b/src/core_plugins/elasticsearch/lib/__tests__/routes.js index 845b34517a06..b70531bc6cff 100644 --- a/src/core_plugins/elasticsearch/lib/__tests__/routes.js +++ b/src/core_plugins/elasticsearch/lib/__tests__/routes.js @@ -105,7 +105,7 @@ describe('plugins/elasticsearch', function () { testRoute({ method: 'POST', url: '/elasticsearch/_msearch?timeout=0&ignore_unavailable=true&preference=1429577952339', - payload: '{"index":"logstash-2015.04.21","ignore_unavailable":true}\n{"size":500,"sort":{"@timestamp":"desc"},"query":{"bool":{"must":[{"query_string":{"analyze_wildcard":true,"query":"*"}},{"bool":{"must":[{"range":{"@timestamp":{"gte":1429577068175,"lte":1429577968175}}}],"must_not":[]}}],"must_not":[]}},"highlight":{"pre_tags":["@kibana-highlighted-field@"],"post_tags":["@/kibana-highlighted-field@"],"fields":{"*":{}}},"aggs":{"2":{"date_histogram":{"field":"@timestamp","interval":"30s","min_doc_count":0,"extended_bounds":{"min":1429577068175,"max":1429577968175}}}},"stored_fields":["*"],"_source": true,"script_fields":{},"fielddata_fields":["timestamp_offset","@timestamp","utc_time"]}\n' // eslint-disable-line max-len + payload: '{"index":"logstash-2015.04.21","ignore_unavailable":true}\n{"size":500,"sort":{"@timestamp":"desc"},"query":{"bool":{"must":[{"query_string":{"analyze_wildcard":true,"query":"*"}},{"bool":{"must":[{"range":{"@timestamp":{"gte":1429577068175,"lte":1429577968175}}}],"must_not":[]}}],"must_not":[]}},"highlight":{"pre_tags":["@kibana-highlighted-field@"],"post_tags":["@/kibana-highlighted-field@"],"fields":{"*":{}}},"aggs":{"2":{"date_histogram":{"field":"@timestamp","interval":"30s","min_doc_count":0,"extended_bounds":{"min":1429577068175,"max":1429577968175}}}},"stored_fields":["*"],"_source": true,"script_fields":{},"docvalue_fields":["timestamp_offset","@timestamp","utc_time"]}\n' // eslint-disable-line max-len }); }); diff --git a/src/core_plugins/kibana/public/doc/controllers/doc.js b/src/core_plugins/kibana/public/doc/controllers/doc.js index 97be464e705d..805aae832f02 100644 --- a/src/core_plugins/kibana/public/doc/controllers/doc.js +++ b/src/core_plugins/kibana/public/doc/controllers/doc.js @@ -53,7 +53,7 @@ app.controller('doc', function ($scope, $route, es, timefilter) { stored_fields: computedFields.storedFields, _source: computedFields._source, script_fields: computedFields.scriptFields, - fielddata_fields: computedFields.fielddataFields + docvalue_fields: computedFields.docvalueFields } }).then(function (resp) { if (resp.hits) { diff --git a/src/ui/public/courier/data_source/_abstract.js b/src/ui/public/courier/data_source/_abstract.js index f2b4eab941af..4829ef661944 100644 --- a/src/ui/public/courier/data_source/_abstract.js +++ b/src/ui/public/courier/data_source/_abstract.js @@ -287,10 +287,10 @@ export default function SourceAbstractFactory(Private, Promise, PromiseEmitter) 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 || []; + flatState.body.docvalue_fields = flatState.body.docvalue_fields || []; _.extend(flatState.body.script_fields, computedFields.scriptFields); - flatState.body.fielddata_fields = _.union(flatState.body.fielddata_fields, computedFields.fielddataFields); + flatState.body.docvalue_fields = _.union(flatState.body.docvalue_fields, computedFields.docvalueFields); } decorateQuery(flatState.body.query); diff --git a/src/ui/public/index_patterns/__tests__/_get_computed_fields.js b/src/ui/public/index_patterns/__tests__/_get_computed_fields.js index d63cb0358a32..ae0da4e11978 100644 --- a/src/ui/public/index_patterns/__tests__/_get_computed_fields.js +++ b/src/ui/public/index_patterns/__tests__/_get_computed_fields.js @@ -30,9 +30,9 @@ describe('get computed fields', function () { expect(fn()._source).to.be(true); }); - it('should request date fields as fielddata_fields', function () { - expect(fn().fielddataFields).to.contain('@timestamp'); - expect(fn().fielddataFields).to.not.include.keys('bytes'); + it('should request date fields as docvalue_fields', function () { + expect(fn().docvalueFields).to.contain('@timestamp'); + expect(fn().docvalueFields).to.not.include.keys('bytes'); }); diff --git a/src/ui/public/index_patterns/_get_computed_fields.js b/src/ui/public/index_patterns/_get_computed_fields.js index 5518ec24c789..8730183a6006 100644 --- a/src/ui/public/index_patterns/_get_computed_fields.js +++ b/src/ui/public/index_patterns/_get_computed_fields.js @@ -4,9 +4,9 @@ import _ from 'lodash'; export default function () { let self = this; let scriptFields = {}; - let fielddataFields = []; + let docvalueFields = []; - fielddataFields = _.pluck(self.fields.byType.date, 'name'); + docvalueFields = _.pluck(self.fields.byType.date, 'name'); _.each(self.getScriptedFields(), function (field) { scriptFields[field.name] = { @@ -21,7 +21,7 @@ export default function () { storedFields: ['*'], _source: true, scriptFields: scriptFields, - fielddataFields: fielddataFields + docvalueFields: docvalueFields }; };