Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[apm] use IndexPattern instead of IIndexPattern #107187

Merged
merged 3 commits into from
Aug 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import React, { useState } from 'react';
import { useHistory, useLocation } from 'react-router-dom';
import {
esKuery,
IIndexPattern,
IndexPattern,
QuerySuggestion,
} from '../../../../../../../src/plugins/data/public';
import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_context';
Expand All @@ -29,7 +29,7 @@ interface State {
isLoadingSuggestions: boolean;
}

function convertKueryToEsQuery(kuery: string, indexPattern: IIndexPattern) {
function convertKueryToEsQuery(kuery: string, indexPattern: IndexPattern) {
const ast = esKuery.fromKueryExpression(kuery);
return esKuery.toElasticsearchQuery(ast, indexPattern);
}
Expand Down Expand Up @@ -125,7 +125,10 @@ export function KueryBar(props: { prepend?: React.ReactNode | string }) {
}

try {
const res = convertKueryToEsQuery(inputValue, indexPattern);
const res = convertKueryToEsQuery(
inputValue,
indexPattern as IndexPattern
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is as IndexPattern really needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is, indexPattern is typed as IndexPatternTitleAndFields which convertKueryToEsQuery complains about.

);
if (!res) {
return;
}
Expand Down