Skip to content

Commit

Permalink
ts fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Liza K committed Mar 10, 2020
1 parent 02a101a commit d5f9f8a
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
*/

import { createSavedQueryService } from './saved_query_service';
import { SavedQueryAttributes } from '../..';
import { FilterStateStore } from '../../../common';
import { SavedQueryAttributes } from './types';

const savedQueryAttributes: SavedQueryAttributes = {
title: 'foo',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ export class SearchSource {

searchRequest.body = searchRequest.body || {};
const { body, index, fields, query, filters, highlightAll } = searchRequest;
searchRequest.indexType = this.getIndexType(index);
searchRequest.type = this.getIndexType(index);

const computedFields = index ? index.getComputedFields() : {};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ function search({
}: SearchStrategySearchParams) {
const abortController = new AbortController();
const searchParams = getSearchParams(config, esShardTimeout);
const promises = searchRequests.map(({ index, indexType, body }) => {
const promises = searchRequests.map(({ index, type, body }) => {
const params = {
index: index.title || index,
indexType,
type,
body,
...searchParams,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ export const esSearchStrategyProvider: TSearchStrategyProvider<typeof ES_SEARCH_
const config = await context.config$.pipe(first()).toPromise();
const defaultParams = getDefaultSearchParams(config);
// fix me
const { indexType, ...rest } = request.params as any;
const { type, ...rest } = request.params;

// Only default index pattern type is supported here.
// See data_enhanced for other type support.
if (!indexType) {
throw new Error(`Unsupported index pattern type ${indexType}`);
if (!type) {
throw new Error(`Unsupported index pattern type ${type}`);
}

const params = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ export const enhancedEsSearchStrategyProvider: TSearchStrategyProvider<typeof ES
) => {
const config = await context.config$.pipe(first()).toPromise();
const defaultParams = getDefaultSearchParams(config);
const { indexType, ...rest } = request.params;
const { type, ...rest } = request.params;
const params = { ...defaultParams, ...rest };

const rawResponse = (await (indexType === 'rollup'
const rawResponse = (await (type === 'rollup'
? rollupSearch(caller, { ...request, params }, options)
: caller('search', params, options))) as SearchResponse<any>;

Expand Down

0 comments on commit d5f9f8a

Please sign in to comment.