Skip to content

Commit

Permalink
Fix ppl commands (#8199)
Browse files Browse the repository at this point in the history
Signed-off-by: sumukhswamy <[email protected]>
(cherry picked from commit 6ebc1e3)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
github-actions[bot] committed Sep 19, 2024
1 parent 2246db5 commit db99919
Showing 1 changed file with 5 additions and 3 deletions.
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 };
}

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

0 comments on commit db99919

Please sign in to comment.