Skip to content

Commit

Permalink
rm types
Browse files Browse the repository at this point in the history
  • Loading branch information
jbudz committed Oct 23, 2019
1 parent ef8c746 commit 9c52b9a
Show file tree
Hide file tree
Showing 59 changed files with 144 additions and 230 deletions.
12 changes: 6 additions & 6 deletions packages/kbn-es/src/custom_snapshots.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@

const { basename } = require('path');

function isVersionFlag(a) {
return a.startsWith('--version');
}
// function isVersionFlag(a) {
// return a.startsWith('--version');
// }

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}';
}
// 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}';
// }

if (process.env.KBN_ES_SNAPSHOT_URL && process.env.KBN_ES_SNAPSHOT_URL !== 'false') {
return process.env.KBN_ES_SNAPSHOT_URL;
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 @@ -760,7 +751,6 @@ describe('SavedObjectsRepository', () => {
items: [
{
create: {
_type: '_doc',
_id: 'config:one',
error: {
reason: 'type[config] missing',
Expand All @@ -769,7 +759,6 @@ describe('SavedObjectsRepository', () => {
},
{
create: {
_type: '_doc',
_id: 'index-pattern:two',
...mockVersionProps,
},
Expand Down Expand Up @@ -807,14 +796,12 @@ describe('SavedObjectsRepository', () => {
items: [
{
create: {
_type: '_doc',
_id: 'config:one',
...mockVersionProps,
},
},
{
create: {
_type: '_doc',
_id: 'index-pattern:two',
...mockVersionProps,
},
Expand Down Expand Up @@ -859,7 +846,6 @@ describe('SavedObjectsRepository', () => {
items: [
{
create: {
_type: '_doc',
_id: 'foo-namespace:config:one',
_index: '.kibana-test',
_primary_term: 1,
Expand All @@ -868,7 +854,6 @@ describe('SavedObjectsRepository', () => {
},
{
create: {
_type: '_doc',
_id: 'foo-namespace:index-pattern:two',
_primary_term: 1,
_seq_no: 2,
Expand Down Expand Up @@ -918,14 +903,12 @@ describe('SavedObjectsRepository', () => {
items: [
{
create: {
_type: '_doc',
_id: 'config:one',
...mockVersionProps,
},
},
{
create: {
_type: '_doc',
_id: 'index-pattern:two',
...mockVersionProps,
},
Expand Down Expand Up @@ -989,7 +972,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 @@ -1351,7 +1334,6 @@ describe('SavedObjectsRepository', () => {
describe('#get', () => {
const noNamespaceResult = {
_id: 'index-pattern:logstash-*',
_type: '_doc',
...mockVersionProps,
_source: {
type: 'index-pattern',
Expand All @@ -1364,7 +1346,6 @@ describe('SavedObjectsRepository', () => {
};
const namespacedResult = {
_id: 'foo-namespace:index-pattern:logstash-*',
_type: '_doc',
...mockVersionProps,
_source: {
namespace: 'foo-namespace',
Expand Down Expand Up @@ -1554,14 +1535,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 @@ -1583,14 +1562,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 @@ -1625,21 +1602,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 @@ -1714,7 +1688,6 @@ describe('SavedObjectsRepository', () => {
beforeEach(() => {
callAdminCluster.mockResolvedValue({
_id: `${type}:${id}`,
_type: '_doc',
...mockVersionProps,
result: 'updated',
});
Expand Down Expand Up @@ -1998,7 +1971,6 @@ describe('SavedObjectsRepository', () => {
items: objects.map(items => ({
update: {
_id: `${items.type}:${items.id}`,
_type: '_doc',
...mockVersionProps,
result: 'updated',
}
Expand Down Expand Up @@ -2065,15 +2037,14 @@ describe('SavedObjectsRepository', () => {

callAdminCluster.mockReturnValue({
items: objects
// remove invalid from mocks
// remove invalid from mocks
.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 @@ -2083,7 +2054,6 @@ describe('SavedObjectsRepository', () => {
return ({
update: {
_id: `${items.type}:${items.id}`,
_type: '_doc',
...mockVersionProps,
result: 'updated',
}
Expand Down Expand Up @@ -2174,7 +2144,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 @@ -2228,7 +2198,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 @@ -2255,7 +2225,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 @@ -2420,7 +2390,6 @@ describe('SavedObjectsRepository', () => {
describe('#incrementCounter', () => {
beforeEach(() => {
callAdminCluster.mockImplementation((method, params) => ({
_type: '_doc',
_id: params.id,
...mockVersionProps,
_index: '.kibana',
Expand All @@ -2440,7 +2409,6 @@ describe('SavedObjectsRepository', () => {

it('formats Elasticsearch response', async () => {
callAdminCluster.mockImplementation((method, params) => ({
_type: '_doc',
_id: params.id,
...mockVersionProps,
_index: '.kibana',
Expand Down Expand Up @@ -2536,7 +2504,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

0 comments on commit 9c52b9a

Please sign in to comment.