Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.17] remove deprecated include_type_name parameter #122929

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ interface SearchResponses {
total: number;
hits: Array<{
_index: string;
_type: string;
_id: string;
_source: Record<string, unknown>;
}>;
Expand Down Expand Up @@ -59,9 +58,9 @@ describe('esArchiver: createGenerateDocRecordsStream()', () => {
hits: {
total: 5,
hits: [
{ _index: 'foo', _type: '_doc', _id: '0', _source: {} },
{ _index: 'foo', _type: '_doc', _id: '1', _source: {} },
{ _index: 'foo', _type: '_doc', _id: '2', _source: {} },
{ _index: 'foo', _id: '0', _source: {} },
{ _index: 'foo', _id: '1', _source: {} },
{ _index: 'foo', _id: '2', _source: {} },
],
},
},
Expand All @@ -71,8 +70,8 @@ describe('esArchiver: createGenerateDocRecordsStream()', () => {
hits: {
total: 5,
hits: [
{ _index: 'foo', _type: '_doc', _id: '3', _source: {} },
{ _index: 'foo', _type: '_doc', _id: '4', _source: {} },
{ _index: 'foo', _id: '3', _source: {} },
{ _index: 'foo', _id: '4', _source: {} },
],
},
},
Expand All @@ -84,8 +83,8 @@ describe('esArchiver: createGenerateDocRecordsStream()', () => {
hits: {
total: 2,
hits: [
{ _index: 'bar', _type: '_doc', _id: '0', _source: {} },
{ _index: 'bar', _type: '_doc', _id: '1', _source: {} },
{ _index: 'bar', _id: '0', _source: {} },
{ _index: 'bar', _id: '1', _source: {} },
],
},
},
Expand All @@ -108,7 +107,6 @@ describe('esArchiver: createGenerateDocRecordsStream()', () => {
createMapStream((record: any) => {
expect(record).toHaveProperty('type', 'doc');
expect(record.value.source).toEqual({});
expect(record.value.type).toBe('_doc');
expect(record.value.index).toMatch(/^(foo|bar)$/);
expect(record.value.id).toMatch(/^\d+$/);
return `${record.value.index}:${record.value.id}`;
Expand Down Expand Up @@ -224,7 +222,7 @@ describe('esArchiver: createGenerateDocRecordsStream()', () => {

describe('keepIndexNames', () => {
it('changes .kibana* index names if keepIndexNames is not enabled', async () => {
const hits = [{ _index: '.kibana_7.16.0_001', _type: '_doc', _id: '0', _source: {} }];
const hits = [{ _index: '.kibana_7.16.0_001', _id: '0', _source: {} }];
const responses = {
['.kibana_7.16.0_001']: [{ body: { hits: { hits, total: hits.length } } }],
};
Expand All @@ -248,7 +246,7 @@ describe('esArchiver: createGenerateDocRecordsStream()', () => {
});

it('does not change non-.kibana* index names if keepIndexNames is not enabled', async () => {
const hits = [{ _index: '.foo', _type: '_doc', _id: '0', _source: {} }];
const hits = [{ _index: '.foo', _id: '0', _source: {} }];
const responses = {
['.foo']: [{ body: { hits: { hits, total: hits.length } } }],
};
Expand All @@ -272,7 +270,7 @@ describe('esArchiver: createGenerateDocRecordsStream()', () => {
});

it('does not change .kibana* index names if keepIndexNames is enabled', async () => {
const hits = [{ _index: '.kibana_7.16.0_001', _type: '_doc', _id: '0', _source: {} }];
const hits = [{ _index: '.kibana_7.16.0_001', _id: '0', _source: {} }];
const responses = {
['.kibana_7.16.0_001']: [{ body: { hits: { hits, total: hits.length } } }],
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ export function createGenerateDocRecordsStream({
// when it is loaded it can skip migration, if possible
index:
hit._index.startsWith('.kibana') && !keepIndexNames ? '.kibana_1' : hit._index,
type: hit._type,
id: hit._id,
source: hit._source,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export function createIndexDocRecordsStream(
ops.set(body, {
[operation]: {
_index: doc.index,
_type: doc.type,
_id: doc.id,
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ export function createCreateIndexStream({

async function handleIndex(record: DocRecord) {
const { index, settings, mappings, aliases } = record.value;

// Determine if the mapping belongs to a pre-7.0 instance, for BWC tests, mainly
const isPre7Mapping = !!mappings && Object.keys(mappings).length > 0 && !mappings.properties;
const isKibanaTaskManager = index.startsWith('.kibana_task_manager');
const isKibana = index.startsWith('.kibana') && !isKibanaTaskManager;

Expand All @@ -79,7 +76,6 @@ export function createCreateIndexStream({
await client.indices.create(
{
index,
include_type_name: isPre7Mapping,
body: {
settings,
mappings,
Expand Down
1 change: 0 additions & 1 deletion packages/kbn-es-archiver/src/lib/indices/kibana_index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ export async function cleanKibanaIndices({
bool: {
must_not: {
ids: {
type: '_doc',
values: ['space:default'],
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"type": "doc",
"value": {
"index": ".kibana",
"type": "doc",
"type": "_doc",
"id": "dashboard:dash-with-missing-refs",
"source": {
"dashboard": {
Expand Down
Loading