Bump saved objects index fields limit to 1.5k to prevent upgrade failures (#138891) (#138912)

* Bump saved objects index fields limit to 1.5k

* Update src/core/server/saved_objects/migrations/actions/create_index.ts

Link to issue which is causing us to require an @ts-expect-error comment

(cherry picked from commit 430e2880df)

Co-authored-by: Rudolf Meijering <skaapgif@gmail.com>
This commit is contained in:
Kibana Machine 2022-08-16 10:19:44 -04:00 committed by GitHub
parent ebbdb6dbb4
commit adee2fac06
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 49 additions and 30 deletions

View file

@ -475,7 +475,7 @@ describe('migration actions', () => {
source: 'existing_index_with_write_block',
target: 'clone_target_1',
});
expect.assertions(1);
expect.assertions(3);
await expect(task()).resolves.toMatchInlineSnapshot(`
Object {
"_tag": "Right",
@ -485,6 +485,12 @@ describe('migration actions', () => {
},
}
`);
const { clone_target_1: cloneTarget1 } = await client.indices.getSettings({
index: 'clone_target_1',
});
// @ts-expect-error https://github.com/elastic/elasticsearch/issues/89381
expect(cloneTarget1.settings?.index.mapping?.total_fields.limit).toBe('1500');
expect(cloneTarget1.settings?.blocks?.write).toBeUndefined();
});
it('resolves right if clone target already existed after waiting for index status to be green ', async () => {
expect.assertions(2);
@ -1612,6 +1618,11 @@ describe('migration actions', () => {
_tag: 'Right',
right: 'create_index_succeeded',
});
const { create_new_index: createNewIndex } = await client.indices.getSettings({
index: 'create_new_index',
});
// @ts-expect-error https://github.com/elastic/elasticsearch/issues/89381
expect(createNewIndex.settings?.index?.mapping.total_fields.limit).toBe('1500');
});
it('resolves left if an existing index status does not become green', async () => {
expect.assertions(2);

View file

@ -64,20 +64,25 @@ export const cloneIndex = ({
index: source,
target,
wait_for_active_shards: WAIT_FOR_ALL_SHARDS_TO_BE_ACTIVE,
body: {
settings: {
index: {
// The source we're cloning from will have a write block set, so
// we need to remove it to allow writes to our newly cloned index
'blocks.write': false,
number_of_shards: INDEX_NUMBER_OF_SHARDS,
auto_expand_replicas: INDEX_AUTO_EXPAND_REPLICAS,
// Set an explicit refresh interval so that we don't inherit the
// value from incorrectly configured index templates (not required
// after we adopt system indices)
refresh_interval: '1s',
// Bump priority so that recovery happens before newer indices
priority: 10,
settings: {
index: {
// The source we're cloning from will have a write block set, so
// we need to remove it to allow writes to our newly cloned index
'blocks.write': false,
// The rest of the index settings should have already been applied
// to the source index and will be copied to the clone target. But
// we repeat it here for explicitness.
number_of_shards: INDEX_NUMBER_OF_SHARDS,
auto_expand_replicas: INDEX_AUTO_EXPAND_REPLICAS,
// Set an explicit refresh interval so that we don't inherit the
// value from incorrectly configured index templates (not required
// after we adopt system indices)
refresh_interval: '1s',
// Bump priority so that recovery happens before newer indices
priority: 10,
// Increase the fields limit beyond the default of 1000
mapping: {
total_fields: { limit: 1500 },
},
},
},

View file

@ -82,21 +82,24 @@ export const createIndex = ({
// available. If the request doesn't complete within timeout,
// acknowledged or shards_acknowledged would be false.
timeout,
body: {
mappings,
aliases: aliasesObject,
settings: {
index: {
// ES rule of thumb: shards should be several GB to 10's of GB, so
// Kibana is unlikely to cross that limit.
number_of_shards: 1,
auto_expand_replicas: INDEX_AUTO_EXPAND_REPLICAS,
// Set an explicit refresh interval so that we don't inherit the
// value from incorrectly configured index templates (not required
// after we adopt system indices)
refresh_interval: '1s',
// Bump priority so that recovery happens before newer indices
priority: 10,
mappings,
aliases: aliasesObject,
settings: {
index: {
// ES rule of thumb: shards should be several GB to 10's of GB, so
// Kibana is unlikely to cross that limit.
number_of_shards: 1,
auto_expand_replicas: INDEX_AUTO_EXPAND_REPLICAS,
// Set an explicit refresh interval so that we don't inherit the
// value from incorrectly configured index templates (not required
// after we adopt system indices)
refresh_interval: '1s',
// Bump priority so that recovery happens before newer indices
priority: 10,
// Increase the fields limit beyond the default of 1000
// @ts-expect-error https://github.com/elastic/elasticsearch/issues/89381
mapping: {
total_fields: { limit: 1500 },
},
},
},