mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
Kibana app migration: Remove old apis (#50881)
This commit is contained in:
parent
0732067dc2
commit
86b3428115
7 changed files with 0 additions and 212 deletions
|
@ -23,8 +23,6 @@ import { promisify } from 'util';
|
|||
|
||||
import { migrations } from './migrations';
|
||||
import manageUuid from './server/lib/manage_uuid';
|
||||
import { searchApi } from './server/routes/api/search';
|
||||
import { scrollSearchApi } from './server/routes/api/scroll_search';
|
||||
import { importApi } from './server/routes/api/import';
|
||||
import { exportApi } from './server/routes/api/export';
|
||||
import { homeApi } from './server/routes/api/home';
|
||||
|
@ -328,9 +326,7 @@ export default function (kibana) {
|
|||
// uuid
|
||||
await manageUuid(server);
|
||||
// routes
|
||||
searchApi(server);
|
||||
scriptsApi(server);
|
||||
scrollSearchApi(server);
|
||||
importApi(server);
|
||||
exportApi(server);
|
||||
homeApi(server);
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
export function scrollSearchApi(server) {
|
||||
server.route({
|
||||
path: '/api/kibana/legacy_scroll_start',
|
||||
method: ['POST'],
|
||||
handler: async (req) => {
|
||||
const { callWithRequest } = server.plugins.elasticsearch.getCluster('admin');
|
||||
const { index, size, body } = req.payload;
|
||||
const params = {
|
||||
index,
|
||||
size,
|
||||
body,
|
||||
scroll: '1m',
|
||||
sort: '_doc',
|
||||
};
|
||||
|
||||
try {
|
||||
return await callWithRequest(req, 'search', params);
|
||||
} catch (err) {
|
||||
throw server.plugins.elasticsearch.handleESError(err);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
server.route({
|
||||
path: '/api/kibana/legacy_scroll_continue',
|
||||
method: ['POST'],
|
||||
handler: async (req) => {
|
||||
const { callWithRequest } = server.plugins.elasticsearch.getCluster('admin');
|
||||
const { scrollId } = req.payload;
|
||||
try {
|
||||
return await callWithRequest(req, 'scroll', { scrollId, scroll: '1m' });
|
||||
} catch (err) {
|
||||
throw server.plugins.elasticsearch.handleESError(err);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
/*
|
||||
* 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 _ from 'lodash';
|
||||
|
||||
export default function registerCount(server) {
|
||||
server.route({
|
||||
path: '/api/kibana/{id}/_count',
|
||||
method: ['POST', 'GET'],
|
||||
handler: async function (req) {
|
||||
const { callWithRequest } = server.plugins.elasticsearch.getCluster('data');
|
||||
const boundCallWithRequest = _.partial(callWithRequest, req);
|
||||
|
||||
try {
|
||||
const res = await boundCallWithRequest('count', {
|
||||
allowNoIndices: false,
|
||||
index: req.params.id
|
||||
});
|
||||
|
||||
return { count: res.count };
|
||||
} catch (err) {
|
||||
throw server.plugins.elasticsearch.handleESError(err);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
/*
|
||||
* 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 registerCount from './count/register_count';
|
||||
|
||||
export function searchApi(server) {
|
||||
registerCount(server);
|
||||
}
|
|
@ -28,7 +28,6 @@ export default function ({ loadTestFile }) {
|
|||
loadTestFile(require.resolve('./management'));
|
||||
loadTestFile(require.resolve('./saved_objects'));
|
||||
loadTestFile(require.resolve('./scripts'));
|
||||
loadTestFile(require.resolve('./search'));
|
||||
loadTestFile(require.resolve('./shorten'));
|
||||
loadTestFile(require.resolve('./suggestions'));
|
||||
loadTestFile(require.resolve('./status'));
|
||||
|
|
|
@ -1,61 +0,0 @@
|
|||
/*
|
||||
* 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 expect from '@kbn/expect';
|
||||
|
||||
export default function ({ getService }) {
|
||||
const esArchiver = getService('esArchiver');
|
||||
const supertest = getService('supertest');
|
||||
|
||||
describe('Count API', function postIngest() {
|
||||
before(() => esArchiver.load('search/count'));
|
||||
after(() => esArchiver.unload('search/count'));
|
||||
|
||||
it('should return 200 with a document count for existing indices', () => (
|
||||
supertest
|
||||
.post('/api/kibana/foo-*/_count')
|
||||
.expect(200)
|
||||
.then((response) => {
|
||||
expect(response.body.count).to.be(2);
|
||||
})
|
||||
));
|
||||
|
||||
it('should support GET requests as well', () => (
|
||||
supertest
|
||||
.get('/api/kibana/foo-*/_count')
|
||||
.expect(200)
|
||||
.then((response) => {
|
||||
expect(response.body.count).to.be(2);
|
||||
})
|
||||
));
|
||||
|
||||
it('should return 404 if a pattern matches no indices', () => (
|
||||
supertest
|
||||
.post('/api/kibana/doesnotexist-*/_count')
|
||||
.expect(404)
|
||||
));
|
||||
|
||||
it('should return 404 if a concrete index does not exist', () => (
|
||||
supertest
|
||||
.post('/api/kibana/concrete/_count')
|
||||
.expect(404)
|
||||
));
|
||||
|
||||
});
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
export default function ({ loadTestFile }) {
|
||||
describe('search', () => {
|
||||
loadTestFile(require.resolve('./count'));
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue