Skip to content

Commit

Permalink
Merge pull request elastic#8005 from thomasneirynck/chore/7986
Browse files Browse the repository at this point in the history
Use docvalue_fields iso fielddata_fields

Former-commit-id: feb790a
  • Loading branch information
thomasneirynck authored Aug 18, 2016
2 parents ce65a88 + db64463 commit 5d9b6c2
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/core_plugins/console/api_server/es_5_0/aggregations.js
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion src/core_plugins/console/api_server/es_5_0/indices.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ module.exports = function (api) {
"fields": [],
"types": [],
"completion_fields": [],
"fielddata_fields": [],
"docvalue_fields": [],
"level": ["cluster", "indices", "shards"]
}

Expand Down
1 change: 0 additions & 1 deletion src/core_plugins/console/api_server/es_5_0/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ module.exports = function (api) {
]
},
stored_fields: ['{field}'],
fielddata_fields: ["{field}"],
docvalue_fields: ["{field}"],
script_fields: {
__template: {
Expand Down
2 changes: 1 addition & 1 deletion src/core_plugins/elasticsearch/lib/__tests__/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
});

});
Expand Down
2 changes: 1 addition & 1 deletion src/core_plugins/kibana/public/doc/controllers/doc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions src/ui/public/courier/data_source/_abstract.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});


Expand Down
6 changes: 3 additions & 3 deletions src/ui/public/index_patterns/_get_computed_fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -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] = {
Expand All @@ -21,7 +21,7 @@ export default function () {
storedFields: ['*'],
_source: true,
scriptFields: scriptFields,
fielddataFields: fielddataFields
docvalueFields: docvalueFields
};

};

0 comments on commit 5d9b6c2

Please sign in to comment.