[Maps] upgrade server to use new elasticsearch-js client (#95314) (#95430)

* [Maps] upgrade server to use new elasticsearch-js client

* update functional test expect
This commit is contained in:
Nathan Reese 2021-03-25 12:28:50 -06:00 committed by GitHub
parent 8f1264b3c7
commit a27786f8dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 10 deletions

View file

@ -575,13 +575,10 @@ export async function initRoutes(
}
try {
const resp = await context.core.elasticsearch.legacy.client.callAsCurrentUser(
'indices.getSettings',
{
index: query.indexPatternTitle,
}
);
const indexPatternSettings = getIndexPatternSettings(resp);
const resp = await context.core.elasticsearch.client.asCurrentUser.indices.getSettings({
index: query.indexPatternTitle,
});
const indexPatternSettings = getIndexPatternSettings(resp.body);
return response.ok({
body: indexPatternSettings,
});

View file

@ -11,6 +11,7 @@ export default function ({ loadTestFile, getService }) {
describe('Maps endpoints', () => {
before(async () => {
await esArchiver.loadIfNeeded('logstash_functional');
await esArchiver.load('maps/data');
});
describe('', () => {

View file

@ -11,7 +11,7 @@ export default function ({ getService }) {
const supertest = getService('supertest');
describe('index settings', () => {
it('should return index settings', async () => {
it('should return default index settings when max_result_window and max_inner_result_window are not set', async () => {
const resp = await supertest
.get(`/api/maps/indexSettings?indexPatternTitle=logstash*`)
.set('kbn-xsrf', 'kibana')
@ -20,5 +20,15 @@ export default function ({ getService }) {
expect(resp.body.maxResultWindow).to.be(10000);
expect(resp.body.maxInnerResultWindow).to.be(100);
});
it('should return index settings', async () => {
const resp = await supertest
.get(`/api/maps/indexSettings?indexPatternTitle=geo_shape*`)
.set('kbn-xsrf', 'kibana')
.expect(200);
expect(resp.body.maxResultWindow).to.be(10001);
expect(resp.body.maxInnerResultWindow).to.be(101);
});
});
}

View file

@ -30,7 +30,7 @@ export default function ({ getPageObjects, getService }) {
//Source should be correct
expect(mapboxStyle.sources[VECTOR_SOURCE_ID].tiles[0]).to.equal(
'/api/maps/mvt/getTile?x={x}&y={y}&z={z}&geometryFieldName=geometry&index=geo_shapes*&requestBody=(_source:!(geometry),docvalue_fields:!(prop1),query:(bool:(filter:!((match_all:())),must:!(),must_not:!(),should:!())),runtime_mappings:(),script_fields:(),size:10000,stored_fields:!(geometry,prop1))&geoFieldType=geo_shape'
'/api/maps/mvt/getTile?x={x}&y={y}&z={z}&geometryFieldName=geometry&index=geo_shapes*&requestBody=(_source:!(geometry),docvalue_fields:!(prop1),query:(bool:(filter:!((match_all:())),must:!(),must_not:!(),should:!())),runtime_mappings:(),script_fields:(),size:10001,stored_fields:!(geometry,prop1))&geoFieldType=geo_shape'
);
//Should correctly load meta for style-rule (sigma is set to 1, opacity to 1)

View file

@ -18,7 +18,9 @@
"settings": {
"index": {
"number_of_replicas": "0",
"number_of_shards": "1"
"number_of_shards": "1",
"max_result_window": "10001",
"max_inner_result_window": "101"
}
}
}