Skip to content

Commit 7934ff4

Browse files
committed
Merge remote-tracking branch 'upstream/7.x' into backport/7.x/pr-76528
2 parents 92ca404 + 9f737ef commit 7934ff4

File tree

118 files changed

+3399
-1127
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+3399
-1127
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) &gt; [ES\_SEARCH\_STRATEGY](./kibana-plugin-plugins-data-server.es_search_strategy.md)
4+
5+
## ES\_SEARCH\_STRATEGY variable
6+
7+
<b>Signature:</b>
8+
9+
```typescript
10+
ES_SEARCH_STRATEGY = "es"
11+
```

docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchstart.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ export interface ISearchStart<SearchStrategyRequest extends IEsSearchRequest = I
1616
| --- | --- | --- |
1717
| [aggs](./kibana-plugin-plugins-data-server.isearchstart.aggs.md) | <code>AggsStart</code> | |
1818
| [getSearchStrategy](./kibana-plugin-plugins-data-server.isearchstart.getsearchstrategy.md) | <code>(name: string) =&gt; ISearchStrategy&lt;SearchStrategyRequest, SearchStrategyResponse&gt;</code> | Get other registered search strategies. For example, if a new strategy needs to use the already-registered ES search strategy, it can use this function to accomplish that. |
19-
| [search](./kibana-plugin-plugins-data-server.isearchstart.search.md) | <code>(context: RequestHandlerContext, request: IKibanaSearchRequest, options: ISearchOptions) =&gt; Promise&lt;IKibanaSearchResponse&gt;</code> | |
19+
| [search](./kibana-plugin-plugins-data-server.isearchstart.search.md) | <code>(context: RequestHandlerContext, request: IEsSearchRequest, options: ISearchOptions) =&gt; Promise&lt;IEsSearchResponse&gt;</code> | |
2020

docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchstart.search.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
<b>Signature:</b>
88

99
```typescript
10-
search: (context: RequestHandlerContext, request: IKibanaSearchRequest, options: ISearchOptions) => Promise<IKibanaSearchResponse>;
10+
search: (context: RequestHandlerContext, request: IEsSearchRequest, options: ISearchOptions) => Promise<IEsSearchResponse>;
1111
```

docs/development/plugins/data/server/kibana-plugin-plugins-data-server.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
| [AggGroupNames](./kibana-plugin-plugins-data-server.agggroupnames.md) | |
7272
| [castEsToKbnFieldTypeName](./kibana-plugin-plugins-data-server.castestokbnfieldtypename.md) | Get the KbnFieldType name for an esType string |
7373
| [config](./kibana-plugin-plugins-data-server.config.md) | |
74+
| [ES\_SEARCH\_STRATEGY](./kibana-plugin-plugins-data-server.es_search_strategy.md) | |
7475
| [esFilters](./kibana-plugin-plugins-data-server.esfilters.md) | |
7576
| [esKuery](./kibana-plugin-plugins-data-server.eskuery.md) | |
7677
| [esQuery](./kibana-plugin-plugins-data-server.esquery.md) | |

src/plugins/data/server/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ export {
201201
ISearchOptions,
202202
IEsSearchRequest,
203203
IEsSearchResponse,
204+
ES_SEARCH_STRATEGY,
204205
// tabify
205206
TabbedAggColumn,
206207
TabbedAggRow,

src/plugins/data/server/search/routes/search.test.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,24 @@ describe('Search service', () => {
4848
});
4949

5050
it('handler calls context.search.search with the given request and strategy', async () => {
51-
const response = { id: 'yay' };
51+
const response = {
52+
id: 'yay',
53+
rawResponse: {
54+
took: 100,
55+
timed_out: true,
56+
_shards: {
57+
total: 0,
58+
successful: 0,
59+
failed: 0,
60+
skipped: 0,
61+
},
62+
hits: {
63+
total: 0,
64+
max_score: 0,
65+
hits: [],
66+
},
67+
},
68+
};
5269
mockDataStart.search.search.mockResolvedValue(response);
5370
const mockContext = {};
5471
const mockBody = { id: undefined, params: {} };

src/plugins/data/server/search/types.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
import { RequestHandlerContext } from '../../../../core/server';
21-
import { IKibanaSearchResponse, IKibanaSearchRequest, ISearchOptions } from '../../common/search';
21+
import { ISearchOptions } from '../../common/search';
2222
import { AggsSetup, AggsStart } from './aggs';
2323
import { SearchUsage } from './collectors/usage';
2424
import { IEsSearchRequest, IEsSearchResponse } from './es_search';
@@ -66,9 +66,9 @@ export interface ISearchStart<
6666
) => ISearchStrategy<SearchStrategyRequest, SearchStrategyResponse>;
6767
search: (
6868
context: RequestHandlerContext,
69-
request: IKibanaSearchRequest,
69+
request: IEsSearchRequest,
7070
options: ISearchOptions
71-
) => Promise<IKibanaSearchResponse>;
71+
) => Promise<IEsSearchResponse>;
7272
}
7373

7474
/**

src/plugins/data/server/server.api.md

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,11 @@ export enum ES_FIELD_TYPES {
323323
_TYPE = "_type"
324324
}
325325

326+
// Warning: (ae-missing-release-tag) "ES_SEARCH_STRATEGY" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
327+
//
328+
// @public (undocumented)
329+
export const ES_SEARCH_STRATEGY = "es";
330+
326331
// Warning: (ae-forgotten-export) The symbol "ExpressionFunctionDefinition" needs to be exported by the entry point index.d.ts
327332
// Warning: (ae-forgotten-export) The symbol "Input" needs to be exported by the entry point index.d.ts
328333
// Warning: (ae-forgotten-export) The symbol "Arguments" needs to be exported by the entry point index.d.ts
@@ -712,7 +717,7 @@ export interface ISearchStart<SearchStrategyRequest extends IEsSearchRequest = I
712717
// Warning: (ae-forgotten-export) The symbol "RequestHandlerContext" needs to be exported by the entry point index.d.ts
713718
//
714719
// (undocumented)
715-
search: (context: RequestHandlerContext, request: IKibanaSearchRequest, options: ISearchOptions) => Promise<IKibanaSearchResponse>;
720+
search: (context: RequestHandlerContext, request: IEsSearchRequest, options: ISearchOptions) => Promise<IEsSearchResponse>;
716721
}
717722

718723
// Warning: (ae-missing-release-tag) "ISearchStrategy" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
@@ -1088,19 +1093,19 @@ export function usageProvider(core: CoreSetup_2): SearchUsage;
10881093
// src/plugins/data/server/index.ts:101:26 - (ae-forgotten-export) The symbol "TruncateFormat" needs to be exported by the entry point index.d.ts
10891094
// src/plugins/data/server/index.ts:127:27 - (ae-forgotten-export) The symbol "isFilterable" needs to be exported by the entry point index.d.ts
10901095
// src/plugins/data/server/index.ts:127:27 - (ae-forgotten-export) The symbol "isNestedField" needs to be exported by the entry point index.d.ts
1091-
// src/plugins/data/server/index.ts:221:20 - (ae-forgotten-export) The symbol "getRequestInspectorStats" needs to be exported by the entry point index.d.ts
1092-
// src/plugins/data/server/index.ts:221:20 - (ae-forgotten-export) The symbol "getResponseInspectorStats" needs to be exported by the entry point index.d.ts
1093-
// src/plugins/data/server/index.ts:221:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts
1094-
// src/plugins/data/server/index.ts:221:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts
1095-
// src/plugins/data/server/index.ts:223:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts
1096-
// src/plugins/data/server/index.ts:224:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts
1097-
// src/plugins/data/server/index.ts:233:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts
1098-
// src/plugins/data/server/index.ts:234:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts
1099-
// src/plugins/data/server/index.ts:235:1 - (ae-forgotten-export) The symbol "Ipv4Address" needs to be exported by the entry point index.d.ts
1100-
// src/plugins/data/server/index.ts:239:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts
1101-
// src/plugins/data/server/index.ts:240:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts
1102-
// src/plugins/data/server/index.ts:244:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts
1103-
// src/plugins/data/server/index.ts:247:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts
1096+
// src/plugins/data/server/index.ts:222:20 - (ae-forgotten-export) The symbol "getRequestInspectorStats" needs to be exported by the entry point index.d.ts
1097+
// src/plugins/data/server/index.ts:222:20 - (ae-forgotten-export) The symbol "getResponseInspectorStats" needs to be exported by the entry point index.d.ts
1098+
// src/plugins/data/server/index.ts:222:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts
1099+
// src/plugins/data/server/index.ts:222:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts
1100+
// src/plugins/data/server/index.ts:224:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts
1101+
// src/plugins/data/server/index.ts:225:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts
1102+
// src/plugins/data/server/index.ts:234:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts
1103+
// src/plugins/data/server/index.ts:235:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts
1104+
// src/plugins/data/server/index.ts:236:1 - (ae-forgotten-export) The symbol "Ipv4Address" needs to be exported by the entry point index.d.ts
1105+
// src/plugins/data/server/index.ts:240:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts
1106+
// src/plugins/data/server/index.ts:241:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts
1107+
// src/plugins/data/server/index.ts:245:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts
1108+
// src/plugins/data/server/index.ts:248:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts
11041109
// src/plugins/data/server/plugin.ts:88:66 - (ae-forgotten-export) The symbol "DataEnhancements" needs to be exported by the entry point index.d.ts
11051110

11061111
// (No @packageDocumentation comment for this package)

src/plugins/vis_type_timelion/server/plugin.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { first } from 'rxjs/operators';
2222
import { TypeOf, schema } from '@kbn/config-schema';
2323
import { RecursiveReadonly } from '@kbn/utility-types';
2424

25+
import { PluginStart } from '../../../../src/plugins/data/server';
2526
import { CoreSetup, PluginInitializerContext } from '../../../../src/core/server';
2627
import { deepFreeze } from '../../../../src/core/server';
2728
import { configSchema } from '../config';
@@ -42,6 +43,10 @@ export interface PluginSetupContract {
4243
uiEnabled: boolean;
4344
}
4445

46+
export interface TimelionPluginStartDeps {
47+
data: PluginStart;
48+
}
49+
4550
/**
4651
* Represents Timelion Plugin instance that will be managed by the Kibana plugin system.
4752
*/
@@ -80,11 +85,12 @@ export class Plugin {
8085
functions,
8186
getFunction,
8287
logger,
88+
core,
8389
};
8490

8591
functionsRoute(router, deps);
8692
runRoute(router, deps);
87-
validateEsRoute(router);
93+
validateEsRoute(router, core);
8894

8995
core.uiSettings.register({
9096
'timelion:es.timefield': {

src/plugins/vis_type_timelion/server/routes/run.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* specific language governing permissions and limitations
1717
* under the License.
1818
*/
19-
import { IRouter, Logger } from 'kibana/server';
19+
import { IRouter, Logger, CoreSetup } from 'kibana/server';
2020
import { schema } from '@kbn/config-schema';
2121
import Bluebird from 'bluebird';
2222
import _ from 'lodash';
@@ -37,10 +37,12 @@ export function runRoute(
3737
logger,
3838
getFunction,
3939
configManager,
40+
core,
4041
}: {
4142
logger: Logger;
4243
getFunction: (name: string) => TimelionFunctionInterface;
4344
configManager: ConfigManager;
45+
core: CoreSetup;
4446
}
4547
) {
4648
router.post(
@@ -81,13 +83,14 @@ export function runRoute(
8183
const uiSettings = await context.core.uiSettings.client.getAll();
8284

8385
const tlConfig = getTlConfig({
86+
context,
8487
request,
8588
settings: _.defaults(uiSettings, timelionDefaults), // Just in case they delete some setting.
8689
getFunction,
90+
getStartServices: core.getStartServices,
8791
allowedGraphiteUrls: configManager.getGraphiteUrls(),
8892
esShardTimeout: configManager.getEsShardTimeout(),
8993
savedObjectsClient: context.core.savedObjects.client,
90-
esDataClient: () => context.core.elasticsearch.legacy.client,
9194
});
9295
const chainRunner = chainRunnerFn(tlConfig);
9396
const sheet = await Bluebird.all(chainRunner.processRequest(request.body));

0 commit comments

Comments
 (0)