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 21, 2024
1 parent a513a8c commit 9452a8c
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 9452a8c

Please sign in to comment.