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

[Bug] Fix ppl commands #8199

Merged
merged 4 commits into from
Sep 19, 2024
Merged
Changes from 3 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 @@ -15,12 +15,12 @@ import {
SearchInterceptorDeps,
} from '../../../data/public';
import {
formatDate,
SEARCH_STRATEGY,
API,
EnhancedFetchContext,
fetch,
formatDate,
QueryAggConfig,
SEARCH_STRATEGY,
} from '../../common';
import { QueryEnhancementsPluginStartDependencies } from '../types';

Expand Down Expand Up @@ -73,8 +73,10 @@ export class PPLSearchInterceptor extends SearchInterceptor {
const query: Query = this.queryService.queryString.getQuery();
const dataset = query.dataset;
if (!dataset || !dataset.timeFieldName) return query;
const [baseQuery, ...afterPipeParts] = query.query.split('|');
const afterPipe = afterPipeParts.length > 0 ? ` | ${afterPipeParts.join('|').trim()}` : '';
const timeFilter = this.getTimeFilter(dataset.timeFieldName);
return { ...query, query: query.query + timeFilter };
return { ...query, query: baseQuery + timeFilter + afterPipe };
Copy link
Member

Choose a reason for hiding this comment

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

would be good if this logic has tests, maybe later as this class doesn't have unit tests yet

Copy link
Member

Choose a reason for hiding this comment

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

+1

}

private getAggConfig(request: IOpenSearchDashboardsSearchRequest, query: Query) {
Expand Down
Loading