mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Maps] fix array values out of order in tooltips (#134588)
* [Maps] fix array values out of order in tooltips * [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix' Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
021b6eab83
commit
eee3f7ec08
1 changed files with 23 additions and 11 deletions
|
@ -589,27 +589,39 @@ export class ESSearchSource extends AbstractESSource implements IMvtVectorSource
|
|||
return {};
|
||||
}
|
||||
|
||||
const { docValueFields } = getDocValueAndSourceFields(
|
||||
indexPattern,
|
||||
this._getTooltipPropertyNames(),
|
||||
'strict_date_optional_time'
|
||||
);
|
||||
|
||||
const initialSearchContext = { docvalue_fields: docValueFields }; // Request fields in docvalue_fields insted of _source
|
||||
const searchService = getSearchService();
|
||||
const searchSource = await searchService.searchSource.create(initialSearchContext as object);
|
||||
const searchSource = await searchService.searchSource.create();
|
||||
searchSource.setField('trackTotalHits', false);
|
||||
|
||||
searchSource.setField('index', indexPattern);
|
||||
searchSource.setField('size', 1);
|
||||
|
||||
const query = {
|
||||
language: 'kuery',
|
||||
query: `_id:"${docId}" and _index:"${index}"`,
|
||||
};
|
||||
|
||||
searchSource.setField('query', query);
|
||||
searchSource.setField('fieldsFromSource', this._getTooltipPropertyNames());
|
||||
|
||||
// searchSource calls dataView.getComputedFields to seed docvalueFields
|
||||
// dataView.getComputedFields adds each date field in the dataView to docvalueFields to ensure standardized date format across kibana
|
||||
// we don't need these as they request unneeded fields and bloat responses
|
||||
// setting fieldsFromSource notifies searchSource to filterout unused docvalueFields
|
||||
// '_id' is used since the value of 'fieldsFromSource' is irreverent because '_source: false'.
|
||||
searchSource.setField('fieldsFromSource', ['_id']);
|
||||
searchSource.setField('source', false);
|
||||
|
||||
// Get all tooltip properties from fields API
|
||||
searchSource.setField(
|
||||
'fields',
|
||||
this._getTooltipPropertyNames().map((fieldName) => {
|
||||
const field = indexPattern.fields.getByName(fieldName);
|
||||
return field && field.type === 'date'
|
||||
? {
|
||||
field: fieldName,
|
||||
format: 'strict_date_optional_time',
|
||||
}
|
||||
: fieldName;
|
||||
})
|
||||
);
|
||||
|
||||
const { rawResponse: resp } = await lastValueFrom(
|
||||
searchSource.fetch$({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue