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

Removes references to Elasticsearch mapping types #47610

Merged
merged 17 commits into from
Nov 11, 2019
Merged
2 changes: 1 addition & 1 deletion packages/kbn-es/src/custom_snapshots.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function isVersionFlag(a) {
function getCustomSnapshotUrl() {
// force use of manually created snapshots until live ones are available
if (!process.env.KBN_ES_SNAPSHOT_URL && !process.argv.some(isVersionFlag)) {
return 'https://storage.googleapis.com/kibana-ci-tmp-artifacts/{name}-{version}-{os}-x86_64.{ext}';
// return 'https://storage.googleapis.com/kibana-ci-tmp-artifacts/{name}-{version}-{os}-x86_64.{ext}';
spalger marked this conversation as resolved.
Show resolved Hide resolved
}

if (process.env.KBN_ES_SNAPSHOT_URL && process.env.KBN_ES_SNAPSHOT_URL !== 'false') {
Expand Down
8 changes: 2 additions & 6 deletions packages/kbn-spec-to-console/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,10 @@ At the root of the Kibana repository, run the following commands:

```sh
# OSS
yarn spec_to_console \
-g "<ELASTICSEARCH-REPO-FOLDER>/rest-api-spec/src/main/resources/rest-api-spec/api/*" \
-d "src/legacy/core_plugins/console/api_server/spec/generated"
yarn spec_to_console -g "<ELASTICSEARCH-REPO-FOLDER>/rest-api-spec/src/main/resources/rest-api-spec/api/*" -d "src/legacy/core_plugins/console/server/api_server/spec/generated"

# X-pack
yarn spec_to_console \
-g "<ELASTICSEARCH-REPO-FOLDER>/x-pack/plugin/src/test/resources/rest-api-spec/api/*" \
-d "x-pack/plugins/console_extensions/spec/generated"
yarn spec_to_console -g "<ELASTICSEARCH-REPO-FOLDER>/x-pack/plugin/src/test/resources/rest-api-spec/api/*" -d "x-pack/legacy/plugins/console_extensions/spec/generated"
```

### Information used in Console that is not available in the REST spec
Expand Down
45 changes: 6 additions & 39 deletions src/core/server/saved_objects/service/lib/repository.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ describe('SavedObjectsRepository', () => {
hits: [
{
_index: '.kibana',
_type: '_doc',
_id: 'index-pattern:logstash-*',
_score: 1,
...mockVersionProps,
Expand All @@ -65,7 +64,6 @@ describe('SavedObjectsRepository', () => {
},
{
_index: '.kibana',
_type: '_doc',
_id: 'config:6.0.0-alpha1',
_score: 1,
...mockVersionProps,
Expand All @@ -80,7 +78,6 @@ describe('SavedObjectsRepository', () => {
},
{
_index: '.kibana',
_type: '_doc',
_id: 'index-pattern:stocks-*',
_score: 1,
...mockVersionProps,
Expand All @@ -96,7 +93,6 @@ describe('SavedObjectsRepository', () => {
},
{
_index: '.kibana',
_type: '_doc',
_id: 'globaltype:something',
_score: 1,
...mockVersionProps,
Expand All @@ -118,7 +114,6 @@ describe('SavedObjectsRepository', () => {
hits: [
{
_index: '.kibana',
_type: '_doc',
_id: 'foo-namespace:index-pattern:logstash-*',
_score: 1,
...mockVersionProps,
Expand All @@ -135,7 +130,6 @@ describe('SavedObjectsRepository', () => {
},
{
_index: '.kibana',
_type: '_doc',
_id: 'foo-namespace:config:6.0.0-alpha1',
_score: 1,
...mockVersionProps,
Expand All @@ -151,7 +145,6 @@ describe('SavedObjectsRepository', () => {
},
{
_index: '.kibana',
_type: '_doc',
_id: 'foo-namespace:index-pattern:stocks-*',
_score: 1,
...mockVersionProps,
Expand All @@ -168,7 +161,6 @@ describe('SavedObjectsRepository', () => {
},
{
_index: '.kibana',
_type: '_doc',
_id: 'globaltype:something',
_score: 1,
...mockVersionProps,
Expand Down Expand Up @@ -290,7 +282,6 @@ describe('SavedObjectsRepository', () => {
describe('#create', () => {
beforeEach(() => {
callAdminCluster.mockImplementation((method, params) => ({
_type: '_doc',
_id: params.id,
...mockVersionProps,
}));
Expand Down Expand Up @@ -863,7 +854,6 @@ describe('SavedObjectsRepository', () => {
items: [
{
create: {
_type: '_doc',
_id: 'config:one',
error: {
reason: 'type[config] missing',
Expand All @@ -872,7 +862,6 @@ describe('SavedObjectsRepository', () => {
},
{
create: {
_type: '_doc',
_id: 'index-pattern:two',
...mockVersionProps,
},
Expand Down Expand Up @@ -910,14 +899,12 @@ describe('SavedObjectsRepository', () => {
items: [
{
create: {
_type: '_doc',
_id: 'config:one',
...mockVersionProps,
},
},
{
create: {
_type: '_doc',
_id: 'index-pattern:two',
...mockVersionProps,
},
Expand Down Expand Up @@ -962,7 +949,6 @@ describe('SavedObjectsRepository', () => {
items: [
{
create: {
_type: '_doc',
_id: 'foo-namespace:config:one',
_index: '.kibana-test',
_primary_term: 1,
Expand All @@ -971,7 +957,6 @@ describe('SavedObjectsRepository', () => {
},
{
create: {
_type: '_doc',
_id: 'foo-namespace:index-pattern:two',
_primary_term: 1,
_seq_no: 2,
Expand Down Expand Up @@ -1021,14 +1006,12 @@ describe('SavedObjectsRepository', () => {
items: [
{
create: {
_type: '_doc',
_id: 'config:one',
...mockVersionProps,
},
},
{
create: {
_type: '_doc',
_id: 'index-pattern:two',
...mockVersionProps,
},
Expand Down Expand Up @@ -1092,7 +1075,7 @@ describe('SavedObjectsRepository', () => {
expect(onBeforeWrite).toHaveBeenCalledTimes(1);
});

it('should return objects in the same order regardless of type', () => {});
it('should return objects in the same order regardless of type', () => { });
});

describe('#delete', () => {
Expand Down Expand Up @@ -1496,7 +1479,6 @@ describe('SavedObjectsRepository', () => {
describe('#get', () => {
const noNamespaceResult = {
_id: 'index-pattern:logstash-*',
_type: '_doc',
...mockVersionProps,
_source: {
type: 'index-pattern',
Expand All @@ -1509,7 +1491,6 @@ describe('SavedObjectsRepository', () => {
};
const namespacedResult = {
_id: 'foo-namespace:index-pattern:logstash-*',
_type: '_doc',
...mockVersionProps,
_source: {
namespace: 'foo-namespace',
Expand Down Expand Up @@ -1699,14 +1680,12 @@ describe('SavedObjectsRepository', () => {
callAdminCluster.mockResolvedValue({
docs: [
{
_type: '_doc',
_id: 'config:good',
found: true,
...mockVersionProps,
_source: { ...mockTimestampFields, config: { title: 'Test' } },
},
{
_type: '_doc',
_id: 'config:bad',
found: false,
},
Expand All @@ -1728,14 +1707,12 @@ describe('SavedObjectsRepository', () => {
callAdminCluster.mockResolvedValue({
docs: [
{
_type: '_doc',
_id: 'config:good',
found: true,
...mockVersionProps,
_source: { ...mockTimestampFields, config: { title: 'Test' } },
},
{
_type: '_doc',
_id: 'config:bad',
found: false,
},
Expand Down Expand Up @@ -1770,21 +1747,18 @@ describe('SavedObjectsRepository', () => {
callAdminCluster.mockResolvedValue({
docs: [
{
_type: '_doc',
_id: 'one',
found: true,
...mockVersionProps,
_source: { ...mockTimestampFields, config: { title: 'Test1' } },
},
{
_type: '_doc',
_id: 'three',
found: true,
...mockVersionProps,
_source: { ...mockTimestampFields, config: { title: 'Test3' } },
},
{
_type: '_doc',
_id: 'five',
found: true,
...mockVersionProps,
Expand Down Expand Up @@ -1859,7 +1833,6 @@ describe('SavedObjectsRepository', () => {
beforeEach(() => {
callAdminCluster.mockResolvedValue({
_id: `${type}:${id}`,
_type: '_doc',
...mockVersionProps,
result: 'updated',
});
Expand Down Expand Up @@ -2177,7 +2150,6 @@ describe('SavedObjectsRepository', () => {
items: objects.map(items => ({
update: {
_id: `${items.type}:${items.id}`,
_type: '_doc',
...mockVersionProps,
result: 'updated',
}
Expand Down Expand Up @@ -2244,15 +2216,14 @@ describe('SavedObjectsRepository', () => {

callAdminCluster.mockReturnValue({
items: objects
// remove invalid from mocks
// remove invalid from mocks
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apologies, had prettier turned on. i'll revert these

.filter(item => item.id !== 'invalid')
.map(items => {
switch(items.id) {
switch (items.id) {
case 'version_clash':
return ({
update: {
_id: `${items.type}:${items.id}`,
_type: '_doc',
error: {
type: 'version_conflict_engine_exception'
}
Expand All @@ -2262,7 +2233,6 @@ describe('SavedObjectsRepository', () => {
return ({
update: {
_id: `${items.type}:${items.id}`,
_type: '_doc',
...mockVersionProps,
result: 'updated',
}
Expand Down Expand Up @@ -2353,7 +2323,7 @@ describe('SavedObjectsRepository', () => {

expect(callAdminCluster).toHaveBeenCalledTimes(1);

const [, { body: [{ update: firstUpdate },, { update: secondUpdate }] }] = callAdminCluster.mock.calls[0];
const [, { body: [{ update: firstUpdate }, , { update: secondUpdate }] }] = callAdminCluster.mock.calls[0];

expect(firstUpdate).toMatchObject({
if_seq_no: 100,
Expand Down Expand Up @@ -2407,7 +2377,7 @@ describe('SavedObjectsRepository', () => {

expect(callAdminCluster).toHaveBeenCalledTimes(1);

const [, { body: [, { doc }] } ] = callAdminCluster.mock.calls[0];
const [, { body: [, { doc }] }] = callAdminCluster.mock.calls[0];

expect(doc).toMatchObject({
references: [{
Expand All @@ -2434,7 +2404,7 @@ describe('SavedObjectsRepository', () => {

expect(callAdminCluster).toHaveBeenCalledTimes(1);

const [, { body: [, { doc }] } ] = callAdminCluster.mock.calls[0];
const [, { body: [, { doc }] }] = callAdminCluster.mock.calls[0];

expect(doc).toMatchObject({
references: [],
Expand Down Expand Up @@ -2637,7 +2607,6 @@ describe('SavedObjectsRepository', () => {
describe('#incrementCounter', () => {
beforeEach(() => {
callAdminCluster.mockImplementation((method, params) => ({
_type: '_doc',
_id: params.id,
...mockVersionProps,
_index: '.kibana',
Expand All @@ -2657,7 +2626,6 @@ describe('SavedObjectsRepository', () => {

it('formats Elasticsearch response', async () => {
callAdminCluster.mockImplementation((method, params) => ({
_type: '_doc',
_id: params.id,
...mockVersionProps,
_index: '.kibana',
Expand Down Expand Up @@ -2776,7 +2744,6 @@ describe('SavedObjectsRepository', () => {

it(`doesn't prepend namespace to the id or add namespace property when providing namespace for namespace agnostic type`, async () => {
callAdminCluster.mockImplementation((method, params) => ({
_type: '_doc',
_id: params.id,
...mockVersionProps,
_index: '.kibana',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ import {

const recordsToBulkBody = records => {
return records.reduce((acc, record) => {
const { index, type, id, source } = record.value;
const { index, id, source } = record.value;

return [
...acc,
{ index: { _index: index, _type: type, _id: id } },
{ index: { _index: index, _id: id } },
source
];
}, []);
Expand Down
1 change: 0 additions & 1 deletion src/es_archiver/lib/docs/index_doc_records_stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export function createIndexDocRecordsStream(client, stats, progress) {
{
index: {
_index: doc.index,
_type: doc.type,
_id: doc.id,
}
},
Expand Down
1 change: 0 additions & 1 deletion src/es_archiver/lib/indices/kibana_index.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ export async function cleanKibanaIndices({ client, stats, log, kibanaPluginIds }
export async function createDefaultSpace({ index, client }) {
await client.create({
index,
type: '_doc',
id: 'space:default',
ignore: 409,
body: {
Expand Down
1 change: 0 additions & 1 deletion src/fixtures/fake_row.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export function getFakeRow(id, mapping) {
_id: id,
_index: 'test',
_source: getFakeRowVals('original', id, mapping),
_type: 'doc',
sort: [id],
};
}
1 change: 0 additions & 1 deletion src/fixtures/hits.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export default function fitsFixture() {
return {
_score: 1,
_id: 1000 + i,
_type: 'test',
_index: 'test-index',
_source: {
'@timestamp': row[0],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# index a doc
PUT index/type/1
PUT index/1
{
"body": "here"
}

# and get it ...
GET index/type/1
GET index/1
Loading