* Server strategy example * Add tsconfig Renamed is_partial to isPartial Added isPartial and isRunning to OSS response type * Docs + remove unused sample code * Fix test naming of arguments * ts * ts fix * Add filters and query input selector * Update examples/search_examples/public/components/app.tsx Co-authored-by: Lukas Olson <olson.lukas@gmail.com> * Use new service * exapmle plugin ts * unsubscribe + use timefilter * typo * docs * Add comments and use agg config * Added agg configs Added field selector Added a custom input param * Adding getEsQuery to query service (??) * Add server side example * docs * caps * list plugin in examples page * fix typo * Update examples/search_examples/public/application.tsx Co-authored-by: Lukas Olson <olson.lukas@gmail.com> * Update examples/search_examples/public/application.tsx Co-authored-by: Lukas Olson <olson.lukas@gmail.com> * Update examples/search_examples/public/components/app.tsx Co-authored-by: Lukas Olson <olson.lukas@gmail.com> * Update examples/search_examples/public/components/app.tsx Co-authored-by: Lukas Olson <olson.lukas@gmail.com> * Update examples/search_examples/public/components/app.tsx Co-authored-by: Lukas Olson <olson.lukas@gmail.com> * eslint Co-authored-by: Lukas Olson <olson.lukas@gmail.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
73 lines
2.1 KiB
TypeScript
73 lines
2.1 KiB
TypeScript
/*
|
|
* Licensed to Elasticsearch B.V. under one or more contributor
|
|
* license agreements. See the NOTICE file distributed with
|
|
* this work for additional information regarding copyright
|
|
* ownership. Elasticsearch B.V. licenses this file to you under
|
|
* the Apache License, Version 2.0 (the "License"); you may
|
|
* not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing,
|
|
* software distributed under the License is distributed on an
|
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
* KIND, either express or implied. See the License for the
|
|
* specific language governing permissions and limitations
|
|
* under the License.
|
|
*/
|
|
|
|
import {
|
|
PluginInitializerContext,
|
|
CoreSetup,
|
|
CoreStart,
|
|
Plugin,
|
|
Logger,
|
|
} from '../../../src/core/server';
|
|
|
|
import {
|
|
SearchExamplesPluginSetup,
|
|
SearchExamplesPluginStart,
|
|
SearchExamplesPluginSetupDeps,
|
|
SearchExamplesPluginStartDeps,
|
|
} from './types';
|
|
import { mySearchStrategyProvider } from './my_strategy';
|
|
import { registerRoutes } from './routes';
|
|
|
|
export class SearchExamplesPlugin
|
|
implements
|
|
Plugin<
|
|
SearchExamplesPluginSetup,
|
|
SearchExamplesPluginStart,
|
|
SearchExamplesPluginSetupDeps,
|
|
SearchExamplesPluginStartDeps
|
|
> {
|
|
private readonly logger: Logger;
|
|
|
|
constructor(initializerContext: PluginInitializerContext) {
|
|
this.logger = initializerContext.logger.get();
|
|
}
|
|
|
|
public setup(
|
|
core: CoreSetup<SearchExamplesPluginStartDeps>,
|
|
deps: SearchExamplesPluginSetupDeps
|
|
) {
|
|
this.logger.debug('search_examples: Setup');
|
|
const router = core.http.createRouter();
|
|
|
|
core.getStartServices().then(([_, depsStart]) => {
|
|
const myStrategy = mySearchStrategyProvider(depsStart.data);
|
|
deps.data.search.registerSearchStrategy('myStrategy', myStrategy);
|
|
registerRoutes(router, depsStart.data);
|
|
});
|
|
|
|
return {};
|
|
}
|
|
|
|
public start(core: CoreStart) {
|
|
this.logger.debug('search_examples: Started');
|
|
return {};
|
|
}
|
|
|
|
public stop() {}
|
|
}
|