[data.search.SearchSource] Remove legacy ES client APIs. (#75943)

This commit is contained in:
Luke Elmers 2020-09-03 11:24:23 -06:00 committed by GitHub
parent c80a733e4c
commit d494f1e7b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 539 additions and 405 deletions

View file

@ -0,0 +1,26 @@
/*
* 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 { FtrProviderContext } from '../../ftr_provider_context';
export default function ({ loadTestFile }: FtrProviderContext) {
describe('search', () => {
loadTestFile(require.resolve('./search'));
});
}

View file

@ -0,0 +1,88 @@
/*
* 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 { FtrProviderContext } from '../../ftr_provider_context';
export default function ({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
describe('msearch', () => {
describe('post', () => {
it('should return 200 when correctly formatted searches are provided', async () =>
await supertest
.post(`/internal/_msearch`)
.send({
searches: [
{
header: { index: 'foo' },
body: {
query: {
match_all: {},
},
},
},
],
})
.expect(200));
it('should return 400 if you provide malformed content', async () =>
await supertest
.post(`/internal/_msearch`)
.send({
foo: false,
})
.expect(400));
it('should require you to provide an index for each request', async () =>
await supertest
.post(`/internal/_msearch`)
.send({
searches: [
{ header: { index: 'foo' }, body: {} },
{ header: {}, body: {} },
],
})
.expect(400));
it('should not require optional params', async () =>
await supertest
.post(`/internal/_msearch`)
.send({
searches: [{ header: { index: 'foo' }, body: {} }],
})
.expect(200));
it('should allow passing preference as a string', async () =>
await supertest
.post(`/internal/_msearch`)
.send({
searches: [{ header: { index: 'foo', preference: '_custom' }, body: {} }],
})
.expect(200));
it('should allow passing preference as a number', async () =>
await supertest
.post(`/internal/_msearch`)
.send({
searches: [{ header: { index: 'foo', preference: 123 }, body: {} }],
})
.expect(200));
});
});
}