Skip to content

Commit

Permalink
Update src/plugins/discover/public/application/main/components/sideba…
Browse files Browse the repository at this point in the history
…r/discover_sidebar.tsx

Co-authored-by: Matthias Wilhelm <[email protected]>
  • Loading branch information
andreadelrio and kertal authored Apr 6, 2022
1 parent 0f97f0b commit 1fb3afb
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,18 @@ export function DiscoverSidebarComponent({
if (Array.isArray(fields)) {
for (const field of fields) {
if (field.type !== '_source') {
dataViewFieldTypes.add(field.type);
// If it's a string type, we want to distinguish between keyword and text
// For this purpose we need the ES type
const type =
field.type === 'string' &&
field.esTypes &&
['keyword', 'text'].includes(field.esTypes[0])
? field.esTypes?.[0]
: field.type;
// _id and _index would map to string, that's why we don't add the string type here
if (type && type !== 'string') {
dataViewFieldTypes.add(type);
}
if (result.indexOf(field.type) === -1) {
result.push(field.type);
}
Expand Down

0 comments on commit 1fb3afb

Please sign in to comment.