From 02c8dc95c7fea685ff263ea9521c2f3c29271c88 Mon Sep 17 00:00:00 2001 From: Matt Apperson Date: Thu, 14 Feb 2019 09:56:36 -0500 Subject: [PATCH] [BeatsCM] remove type from ES template and requests (#30549) (#30823) (#31116) * remove dype from ES template and requests * remove doc type? --- .../index_templates/beats_template.json | 230 +++++++++--------- .../beats/elasticsearch_beats_adapter.ts | 9 - ...asticsearch_configuration_block_adapter.ts | 5 - .../database/__tests__/test_contract.ts | 2 - .../lib/adapters/database/adapter_types.ts | 12 - .../tags/elasticsearch_tags_adapter.ts | 6 - .../tokens/elasticsearch_tokens_adapter.ts | 3 - .../server/rest_api/__tests__/data.json | 10 - .../apis/beats/assign_tags_to_beats.js | 12 +- .../api_integration/apis/beats/constants.js | 1 - .../apis/beats/create_enrollment_tokens.js | 42 ++-- .../api_integration/apis/beats/enroll_beat.js | 8 +- .../api_integration/apis/beats/get_beat.js | 3 +- .../apis/beats/remove_tags_from_beats.js | 10 +- .../api_integration/apis/beats/set_config.js | 3 +- .../api_integration/apis/beats/set_tag.js | 4 +- .../api_integration/apis/beats/update_beat.js | 5 +- .../es_archives/beats/list/data.json | 10 - 18 files changed, 137 insertions(+), 238 deletions(-) diff --git a/x-pack/plugins/beats_management/server/index_templates/beats_template.json b/x-pack/plugins/beats_management/server/index_templates/beats_template.json index 5631322148f6e..36fc753c68745 100644 --- a/x-pack/plugins/beats_management/server/index_templates/beats_template.json +++ b/x-pack/plugins/beats_management/server/index_templates/beats_template.json @@ -1,6 +1,6 @@ { "index_patterns": [".management-beats"], - "version": 67000, + "version": 70000, "settings": { "index": { "number_of_shards": 1, @@ -9,128 +9,126 @@ } }, "mappings": { - "_doc": { - "dynamic": "strict", - "properties": { - "type": { - "type": "keyword" - }, - "configuration_block": { - "properties": { - "id": { - "type": "keyword" - }, - "type": { - "type": "keyword" - }, - "tag": { - "type": "keyword" - }, - "description": { - "type": "text" - }, - "config": { - "type": "keyword" - }, - "last_updated": { - "type": "date" - } + "dynamic": "strict", + "properties": { + "type": { + "type": "keyword" + }, + "configuration_block": { + "properties": { + "id": { + "type": "keyword" + }, + "type": { + "type": "keyword" + }, + "tag": { + "type": "keyword" + }, + "description": { + "type": "text" + }, + "config": { + "type": "keyword" + }, + "last_updated": { + "type": "date" } - }, - "enrollment_token": { - "properties": { - "token": { - "type": "keyword" - }, - "expires_on": { - "type": "date" - } + } + }, + "enrollment_token": { + "properties": { + "token": { + "type": "keyword" + }, + "expires_on": { + "type": "date" } - }, - "tag": { - "properties": { - "id": { - "type": "keyword" - }, - "name": { - "type": "keyword" - }, - "color": { - "type": "keyword" - }, - "hasConfigurationBlocksTypes": { - "type": "keyword" - } + } + }, + "tag": { + "properties": { + "id": { + "type": "keyword" + }, + "name": { + "type": "keyword" + }, + "color": { + "type": "keyword" + }, + "hasConfigurationBlocksTypes": { + "type": "keyword" } - }, - "beat": { - "properties": { - "id": { - "type": "keyword" - }, - "status": { - "properties": { - "type": { - "type": "keyword" - }, - "timestamp": { - "type": "date" - }, - "event": { - "properties": { - "type": { - "type": "keyword" - }, - "message": { - "type": "text" - }, - "uuid": { - "type": "keyword" - } + } + }, + "beat": { + "properties": { + "id": { + "type": "keyword" + }, + "status": { + "properties": { + "type": { + "type": "keyword" + }, + "timestamp": { + "type": "date" + }, + "event": { + "properties": { + "type": { + "type": "keyword" + }, + "message": { + "type": "text" + }, + "uuid": { + "type": "keyword" } } } - }, - "active": { - "type": "boolean" - }, - "last_checkin": { - "type": "date" - }, - "enrollment_token": { - "type": "keyword" - }, - "access_token": { - "type": "keyword" - }, - "verified_on": { - "type": "date" - }, - "type": { - "type": "keyword" - }, - "version": { - "type": "keyword" - }, - "host_ip": { - "type": "ip" - }, - "host_name": { - "type": "keyword" - }, - "ephemeral_id": { - "type": "keyword" - }, - "tags": { - "type": "keyword" - }, - "metadata": { - "dynamic": "true", - "type": "object" - }, - "name": { - "type": "keyword" } + }, + "active": { + "type": "boolean" + }, + "last_checkin": { + "type": "date" + }, + "enrollment_token": { + "type": "keyword" + }, + "access_token": { + "type": "keyword" + }, + "verified_on": { + "type": "date" + }, + "type": { + "type": "keyword" + }, + "version": { + "type": "keyword" + }, + "host_ip": { + "type": "ip" + }, + "host_name": { + "type": "keyword" + }, + "ephemeral_id": { + "type": "keyword" + }, + "tags": { + "type": "keyword" + }, + "metadata": { + "dynamic": "true", + "type": "object" + }, + "name": { + "type": "keyword" } } } diff --git a/x-pack/plugins/beats_management/server/lib/adapters/beats/elasticsearch_beats_adapter.ts b/x-pack/plugins/beats_management/server/lib/adapters/beats/elasticsearch_beats_adapter.ts index 8ee2022e2bddd..1ab7418c15614 100644 --- a/x-pack/plugins/beats_management/server/lib/adapters/beats/elasticsearch_beats_adapter.ts +++ b/x-pack/plugins/beats_management/server/lib/adapters/beats/elasticsearch_beats_adapter.ts @@ -23,7 +23,6 @@ export class ElasticsearchBeatsAdapter implements CMBeatsAdapter { id: `beat:${id}`, ignore: [404], index: INDEX_NAMES.BEATS, - type: '_doc', }; const response = await this.database.get(user, params); @@ -46,7 +45,6 @@ export class ElasticsearchBeatsAdapter implements CMBeatsAdapter { id: `beat:${beat.id}`, index: INDEX_NAMES.BEATS, refresh: 'wait_for', - type: '_doc', }); } @@ -61,7 +59,6 @@ export class ElasticsearchBeatsAdapter implements CMBeatsAdapter { id: `beat:${beat.id}`, index: INDEX_NAMES.BEATS, refresh: 'wait_for', - type: '_doc', }; await this.database.index(user, params); } @@ -74,7 +71,6 @@ export class ElasticsearchBeatsAdapter implements CMBeatsAdapter { ids, }, index: INDEX_NAMES.BEATS, - type: '_doc', }; const response = await this.database.mget(user, params); @@ -87,7 +83,6 @@ export class ElasticsearchBeatsAdapter implements CMBeatsAdapter { const params = { ignore: [404], index: INDEX_NAMES.BEATS, - type: '_doc', body: { query: { terms: { 'beat.tags': tagIds }, @@ -115,7 +110,6 @@ export class ElasticsearchBeatsAdapter implements CMBeatsAdapter { const params = { ignore: [404], index: INDEX_NAMES.BEATS, - type: '_doc', body: { query: { match: { 'beat.enrollment_token': enrollmentToken }, @@ -140,7 +134,6 @@ export class ElasticsearchBeatsAdapter implements CMBeatsAdapter { index: INDEX_NAMES.BEATS, size: 10000, ignore: [404], - type: '_doc', body: { query: { bool: { @@ -201,7 +194,6 @@ export class ElasticsearchBeatsAdapter implements CMBeatsAdapter { body, index: INDEX_NAMES.BEATS, refresh: 'wait_for', - type: '_doc', }); return _get(response, 'items', []).map((item: any, resultIdx: number) => ({ idxInRequest: removals[resultIdx].idxInRequest, @@ -236,7 +228,6 @@ export class ElasticsearchBeatsAdapter implements CMBeatsAdapter { body, index: INDEX_NAMES.BEATS, refresh: 'wait_for', - type: '_doc', }); // console.log(response.items[0].update.error); return _get(response, 'items', []).map((item: any, resultIdx: any) => ({ diff --git a/x-pack/plugins/beats_management/server/lib/adapters/configuration_blocks/elasticsearch_configuration_block_adapter.ts b/x-pack/plugins/beats_management/server/lib/adapters/configuration_blocks/elasticsearch_configuration_block_adapter.ts index d6a10f46a0249..f48b1807d7777 100644 --- a/x-pack/plugins/beats_management/server/lib/adapters/configuration_blocks/elasticsearch_configuration_block_adapter.ts +++ b/x-pack/plugins/beats_management/server/lib/adapters/configuration_blocks/elasticsearch_configuration_block_adapter.ts @@ -29,7 +29,6 @@ export class ElasticsearchConfigurationBlockAdapter implements ConfigurationBloc _source: true, size: 10000, index: INDEX_NAMES.BEATS, - type: '_doc', body: { ids: ids.map(id => `configuration_block:${id}`), }, @@ -58,7 +57,6 @@ export class ElasticsearchConfigurationBlockAdapter implements ConfigurationBloc const params = { ignore: [404], index: INDEX_NAMES.BEATS, - type: '_doc', body: { from: page === -1 ? undefined : page * size, size, @@ -93,7 +91,6 @@ export class ElasticsearchConfigurationBlockAdapter implements ConfigurationBloc body: ids.map(id => ({ delete: { _id: `configuration_block:${id}` } })), index: INDEX_NAMES.BEATS, refresh: 'wait_for', - type: '_doc', }); if (result.errors) { @@ -123,7 +120,6 @@ export class ElasticsearchConfigurationBlockAdapter implements ConfigurationBloc }, }, index: INDEX_NAMES.BEATS, - type: '_doc', }); if (result.failures.length > 0) { @@ -156,7 +152,6 @@ export class ElasticsearchConfigurationBlockAdapter implements ConfigurationBloc body, index: INDEX_NAMES.BEATS, refresh: 'wait_for', - type: '_doc', }); if (result.errors) { diff --git a/x-pack/plugins/beats_management/server/lib/adapters/database/__tests__/test_contract.ts b/x-pack/plugins/beats_management/server/lib/adapters/database/__tests__/test_contract.ts index bf1286ac9fbb3..369c2e1056211 100644 --- a/x-pack/plugins/beats_management/server/lib/adapters/database/__tests__/test_contract.ts +++ b/x-pack/plugins/beats_management/server/lib/adapters/database/__tests__/test_contract.ts @@ -31,7 +31,6 @@ export const contractTests = (testName: string, config: ContractConfig) => { id: `beat:foo`, ignore: [404], index: '.management-beats', - type: '_doc', }; let ranWithoutError = false; try { @@ -48,7 +47,6 @@ export const contractTests = (testName: string, config: ContractConfig) => { id: `beat:foo`, ignore: [404], index: '.management-beats', - type: '_doc', }; const response = await database.get({ kind: 'internal' }, params); diff --git a/x-pack/plugins/beats_management/server/lib/adapters/database/adapter_types.ts b/x-pack/plugins/beats_management/server/lib/adapters/database/adapter_types.ts index bd0411d1fa781..0a06c3dcc6412 100644 --- a/x-pack/plugins/beats_management/server/lib/adapters/database/adapter_types.ts +++ b/x-pack/plugins/beats_management/server/lib/adapters/database/adapter_types.ts @@ -97,7 +97,6 @@ export interface DatabaseSearchResponse { max_score: number; hits: Array<{ _index: string; - _type: string; _id: string; _score: number; _source: T; @@ -128,7 +127,6 @@ export interface DatabaseShardsResponse { export interface DatabaseGetDocumentResponse { _index: string; - _type: string; _id: string; _seq_no: number; _primary_term: number; @@ -149,7 +147,6 @@ export interface DatabaseBulkIndexDocumentsParams extends DatabaseGenericParams refresh?: DatabaseRefresh; routing?: string; timeout?: string; - type?: string; fields?: DatabaseNameList; _source?: DatabaseNameList; _sourceExclude?: DatabaseNameList; @@ -167,7 +164,6 @@ export interface DatabaseMGetParams extends DatabaseGenericParams { _sourceExclude?: DatabaseNameList; _source_includes?: DatabaseNameList; index: string; - type?: string; } export interface DatabaseMGetResponse { @@ -188,14 +184,12 @@ export interface DatabaseDeleteDocumentParams extends DatabaseGenericParams { ifSeqNo?: number; ifPrimaryTerm?: number; index: string; - type: string; id: string; } export interface DatabaseIndexDocumentResponse { found: boolean; _index: string; - _type: string; _id: string; _seq_no: number; _primary_term: number; @@ -205,7 +199,6 @@ export interface DatabaseIndexDocumentResponse { export interface DatabaseUpdateDocumentResponse { found: boolean; _index: string; - _type: string; _id: string; _seq_no: number; _primary_term: number; @@ -215,7 +208,6 @@ export interface DatabaseUpdateDocumentResponse { export interface DatabaseDeleteDocumentResponse { found: boolean; _index: string; - _type: string; _id: string; _seq_no: number; _primary_term: number; @@ -236,7 +228,6 @@ export interface DatabaseIndexDocumentParams extends DatabaseGenericParams { pipeline?: string; id?: string; index: string; - type: string; body: T; } @@ -257,7 +248,6 @@ export interface DatabaseCreateDocumentParams extends DatabaseGenericParams { pipeline?: string; id?: string; index: string; - type: string; } export interface DatabaseCreateDocumentResponse { @@ -274,7 +264,6 @@ export interface DatabaseDeleteDocumentParams extends DatabaseGenericParams { ifSeqNo?: number; ifPrimaryTerm?: number; index: string; - type: string; id: string; } @@ -292,7 +281,6 @@ export interface DatabaseGetParams extends DatabaseGenericParams { ifPrimaryTerm?: number; id: string; index: string; - type: string; } export type DatabaseNameList = string | string[] | boolean; diff --git a/x-pack/plugins/beats_management/server/lib/adapters/tags/elasticsearch_tags_adapter.ts b/x-pack/plugins/beats_management/server/lib/adapters/tags/elasticsearch_tags_adapter.ts index d0a793af2d657..6e4613e3f2fd5 100644 --- a/x-pack/plugins/beats_management/server/lib/adapters/tags/elasticsearch_tags_adapter.ts +++ b/x-pack/plugins/beats_management/server/lib/adapters/tags/elasticsearch_tags_adapter.ts @@ -24,7 +24,6 @@ export class ElasticsearchTagsAdapter implements CMTagsAdapter { _source: true, size: 10000, index: INDEX_NAMES.BEATS, - type: '_doc', body: { query: { bool: { @@ -55,7 +54,6 @@ export class ElasticsearchTagsAdapter implements CMTagsAdapter { const params = { ignore: [404], index: INDEX_NAMES.BEATS, - type: '_doc', body: { query: { terms: { 'beat.tags': tagIds }, @@ -100,7 +98,6 @@ export class ElasticsearchTagsAdapter implements CMTagsAdapter { body: flatten([...bulkInactiveBeatsUpdates, ...bulkTagsDelete]), index: INDEX_NAMES.BEATS, refresh: 'wait_for', - type: '_doc', }); return true; @@ -119,7 +116,6 @@ export class ElasticsearchTagsAdapter implements CMTagsAdapter { ids, }, index: INDEX_NAMES.BEATS, - type: '_doc', }; const response = await this.database.mget(user, params); @@ -143,7 +139,6 @@ export class ElasticsearchTagsAdapter implements CMTagsAdapter { id: `tag:${tag.id}`, index: INDEX_NAMES.BEATS, refresh: 'wait_for', - type: '_doc', }; const response = await this.database.index(user, params); @@ -175,7 +170,6 @@ export class ElasticsearchTagsAdapter implements CMTagsAdapter { ignore: [404], _source: true, size: 10000, - type: '_doc', }; const response = await this.database.search(user, params); const tags = get(response, 'hits.hits', []); diff --git a/x-pack/plugins/beats_management/server/lib/adapters/tokens/elasticsearch_tokens_adapter.ts b/x-pack/plugins/beats_management/server/lib/adapters/tokens/elasticsearch_tokens_adapter.ts index 625628fa6647a..57861ca0c4728 100644 --- a/x-pack/plugins/beats_management/server/lib/adapters/tokens/elasticsearch_tokens_adapter.ts +++ b/x-pack/plugins/beats_management/server/lib/adapters/tokens/elasticsearch_tokens_adapter.ts @@ -17,7 +17,6 @@ export class ElasticsearchTokensAdapter implements CMTokensAdapter { const params = { id: `enrollment_token:${enrollmentToken}`, index: INDEX_NAMES.BEATS, - type: '_doc', }; await this.database.delete(user, params); @@ -31,7 +30,6 @@ export class ElasticsearchTokensAdapter implements CMTokensAdapter { id: `enrollment_token:${tokenString}`, ignore: [404], index: INDEX_NAMES.BEATS, - type: '_doc', }; const response = await this.database.get(user, params); @@ -65,7 +63,6 @@ export class ElasticsearchTokensAdapter implements CMTokensAdapter { body, index: INDEX_NAMES.BEATS, refresh: 'wait_for', - type: '_doc', }); if (result.errors) { diff --git a/x-pack/plugins/beats_management/server/rest_api/__tests__/data.json b/x-pack/plugins/beats_management/server/rest_api/__tests__/data.json index eec393519a52f..4ee5a4a7e2d55 100644 --- a/x-pack/plugins/beats_management/server/rest_api/__tests__/data.json +++ b/x-pack/plugins/beats_management/server/rest_api/__tests__/data.json @@ -1,5 +1,4 @@ { - "type": "doc", "value": { "index": ".management-beats", "type": "_doc", @@ -20,7 +19,6 @@ } { - "type": "doc", "value": { "index": ".management-beats", "type": "_doc", @@ -41,7 +39,6 @@ } { - "type": "doc", "value": { "index": ".management-beats", "type": "_doc", @@ -67,7 +64,6 @@ } { - "type": "doc", "value": { "index": ".management-beats", "type": "_doc", @@ -88,7 +84,6 @@ } { - "type": "doc", "value": { "index": ".management-beats", "type": "_doc", @@ -103,7 +98,6 @@ } { - "type": "doc", "value": { "index": ".management-beats", "type": "_doc", @@ -118,7 +112,6 @@ } { - "type": "doc", "value": { "index": ".management-beats", "type": "_doc", @@ -133,7 +126,6 @@ } { - "type": "doc", "value": { "index": ".management-beats", "type": "_doc", @@ -152,7 +144,6 @@ } { - "type": "doc", "value": { "index": ".management-beats", "type": "_doc", @@ -170,7 +161,6 @@ } { - "type": "doc", "value": { "index": ".management-beats", "type": "_doc", diff --git a/x-pack/test/api_integration/apis/beats/assign_tags_to_beats.js b/x-pack/test/api_integration/apis/beats/assign_tags_to_beats.js index f5a117bfb359a..a1268eea645eb 100644 --- a/x-pack/test/api_integration/apis/beats/assign_tags_to_beats.js +++ b/x-pack/test/api_integration/apis/beats/assign_tags_to_beats.js @@ -5,7 +5,7 @@ */ import expect from 'expect.js'; -import { ES_INDEX_NAME, ES_TYPE_NAME } from './constants'; +import { ES_INDEX_NAME } from './constants'; export default function ({ getService }) { const supertest = getService('supertest'); @@ -32,7 +32,6 @@ export default function ({ getService }) { const esResponse = await es.get({ index: ES_INDEX_NAME, - type: ES_TYPE_NAME, id: `beat:bar`, }); @@ -49,7 +48,6 @@ export default function ({ getService }) { // Before adding the existing tag esResponse = await es.get({ index: ES_INDEX_NAME, - type: ES_TYPE_NAME, id: `beat:foo`, }); @@ -70,7 +68,6 @@ export default function ({ getService }) { // After adding the existing tag esResponse = await es.get({ index: ES_INDEX_NAME, - type: ES_TYPE_NAME, id: `beat:foo`, }); @@ -101,7 +98,6 @@ export default function ({ getService }) { // Beat foo esResponse = await es.get({ index: ES_INDEX_NAME, - type: ES_TYPE_NAME, id: `beat:foo`, }); @@ -111,7 +107,6 @@ export default function ({ getService }) { // Beat bar esResponse = await es.get({ index: ES_INDEX_NAME, - type: ES_TYPE_NAME, id: `beat:bar`, }); @@ -138,7 +133,6 @@ export default function ({ getService }) { const esResponse = await es.get({ index: ES_INDEX_NAME, - type: ES_TYPE_NAME, id: `beat:bar`, }); @@ -169,7 +163,6 @@ export default function ({ getService }) { // Beat foo esResponse = await es.get({ index: ES_INDEX_NAME, - type: ES_TYPE_NAME, id: `beat:foo`, }); @@ -179,7 +172,6 @@ export default function ({ getService }) { // Beat bar esResponse = await es.get({ index: ES_INDEX_NAME, - type: ES_TYPE_NAME, id: `beat:bar`, }); @@ -220,7 +212,6 @@ export default function ({ getService }) { const esResponse = await es.get({ index: ES_INDEX_NAME, - type: ES_TYPE_NAME, id: `beat:bar`, }); @@ -246,7 +237,6 @@ export default function ({ getService }) { const esResponse = await es.get({ index: ES_INDEX_NAME, - type: ES_TYPE_NAME, id: `beat:bar`, }); diff --git a/x-pack/test/api_integration/apis/beats/constants.js b/x-pack/test/api_integration/apis/beats/constants.js index f5a0f2a91fef5..d0c26a1d53323 100644 --- a/x-pack/test/api_integration/apis/beats/constants.js +++ b/x-pack/test/api_integration/apis/beats/constants.js @@ -5,4 +5,3 @@ */ export const ES_INDEX_NAME = '.management-beats'; -export const ES_TYPE_NAME = '_doc'; diff --git a/x-pack/test/api_integration/apis/beats/create_enrollment_tokens.js b/x-pack/test/api_integration/apis/beats/create_enrollment_tokens.js index 86b80323773b4..7118d3307aa14 100644 --- a/x-pack/test/api_integration/apis/beats/create_enrollment_tokens.js +++ b/x-pack/test/api_integration/apis/beats/create_enrollment_tokens.js @@ -6,10 +6,7 @@ import expect from 'expect.js'; import moment from 'moment'; -import { - ES_INDEX_NAME, - ES_TYPE_NAME -} from './constants'; +import { ES_INDEX_NAME } from './constants'; export default function ({ getService }) { const supertest = getService('supertest'); @@ -19,9 +16,7 @@ export default function ({ getService }) { describe('create_enrollment_token', () => { it('should create one token by default', async () => { const { body: apiResponse } = await supertest - .post( - '/api/beats/enrollment_tokens' - ) + .post('/api/beats/enrollment_tokens') .set('kbn-xsrf', 'xxx') .send() .expect(200); @@ -30,12 +25,10 @@ export default function ({ getService }) { const esResponse = await es.search({ index: ES_INDEX_NAME, - type: ES_TYPE_NAME, - q: 'type:enrollment_token' + q: 'type:enrollment_token', }); - const tokensInEs = esResponse.hits.hits - .map(hit => hit._source.enrollment_token.token); + const tokensInEs = esResponse.hits.hits.map(hit => hit._source.enrollment_token.token); expect(tokensFromApi.length).to.eql(1); expect(tokensFromApi).to.eql(tokensInEs); @@ -45,12 +38,10 @@ export default function ({ getService }) { const numTokens = chance.integer({ min: 1, max: 2000 }); const { body: apiResponse } = await supertest - .post( - '/api/beats/enrollment_tokens' - ) + .post('/api/beats/enrollment_tokens') .set('kbn-xsrf', 'xxx') .send({ - num_tokens: numTokens + num_tokens: numTokens, }) .expect(200); @@ -58,13 +49,11 @@ export default function ({ getService }) { const esResponse = await es.search({ index: ES_INDEX_NAME, - type: ES_TYPE_NAME, q: 'type:enrollment_token', - size: numTokens + size: numTokens, }); - const tokensInEs = esResponse.hits.hits - .map(hit => hit._source.enrollment_token.token); + const tokensInEs = esResponse.hits.hits.map(hit => hit._source.enrollment_token.token); expect(tokensFromApi.length).to.eql(numTokens); expect(tokensFromApi).to.eql(tokensInEs); @@ -72,17 +61,14 @@ export default function ({ getService }) { it('should set token expiration to 10 minutes from now by default', async () => { await supertest - .post( - '/api/beats/enrollment_tokens' - ) + .post('/api/beats/enrollment_tokens') .set('kbn-xsrf', 'xxx') .send() .expect(200); const esResponse = await es.search({ index: ES_INDEX_NAME, - type: ES_TYPE_NAME, - q: 'type:enrollment_token' + q: 'type:enrollment_token', }); const tokenInEs = esResponse.hits.hits[0]._source.enrollment_token; @@ -91,8 +77,12 @@ export default function ({ getService }) { // from now because a bit of time has elapsed been the creation of the // tokens and this check. const tokenExpiresOn = moment(tokenInEs.expires_on).valueOf(); - const tenMinutesFromNow = moment().add('10', 'minutes').valueOf(); - const almostTenMinutesFromNow = moment(tenMinutesFromNow).subtract('2', 'seconds').valueOf(); + const tenMinutesFromNow = moment() + .add('10', 'minutes') + .valueOf(); + const almostTenMinutesFromNow = moment(tenMinutesFromNow) + .subtract('2', 'seconds') + .valueOf(); expect(tokenExpiresOn).to.be.lessThan(tenMinutesFromNow); expect(tokenExpiresOn).to.be.greaterThan(almostTenMinutesFromNow); }); diff --git a/x-pack/test/api_integration/apis/beats/enroll_beat.js b/x-pack/test/api_integration/apis/beats/enroll_beat.js index 983182184a630..72933f2950225 100644 --- a/x-pack/test/api_integration/apis/beats/enroll_beat.js +++ b/x-pack/test/api_integration/apis/beats/enroll_beat.js @@ -7,7 +7,7 @@ import expect from 'expect.js'; import moment from 'moment'; -import { ES_INDEX_NAME, ES_TYPE_NAME } from './constants'; +import { ES_INDEX_NAME } from './constants'; export default function ({ getService }) { const supertest = getService('supertest'); @@ -39,7 +39,6 @@ export default function ({ getService }) { await es.index({ index: ES_INDEX_NAME, - type: ES_TYPE_NAME, id: `enrollment_token:${validEnrollmentToken}`, body: { type: 'enrollment_token', @@ -63,7 +62,6 @@ export default function ({ getService }) { const esResponse = await es.get({ index: ES_INDEX_NAME, - type: ES_TYPE_NAME, id: `beat:${beatId}`, }); @@ -83,7 +81,6 @@ export default function ({ getService }) { const esResponse = await es.get({ index: ES_INDEX_NAME, - type: ES_TYPE_NAME, id: `beat:${beatId}`, }); @@ -112,7 +109,6 @@ export default function ({ getService }) { await es.index({ index: ES_INDEX_NAME, - type: ES_TYPE_NAME, id: `enrollment_token:${expiredEnrollmentToken}`, body: { type: 'enrollment_token', @@ -145,7 +141,6 @@ export default function ({ getService }) { const esResponse = await es.get({ index: ES_INDEX_NAME, - type: ES_TYPE_NAME, id: `enrollment_token:${validEnrollmentToken}`, ignore: [404], }); @@ -163,7 +158,6 @@ export default function ({ getService }) { await es.index({ index: ES_INDEX_NAME, - type: ES_TYPE_NAME, id: `enrollment_token:${validEnrollmentToken}`, body: { type: 'enrollment_token', diff --git a/x-pack/test/api_integration/apis/beats/get_beat.js b/x-pack/test/api_integration/apis/beats/get_beat.js index 74b15b8bbe717..bb300f5c3e230 100644 --- a/x-pack/test/api_integration/apis/beats/get_beat.js +++ b/x-pack/test/api_integration/apis/beats/get_beat.js @@ -5,7 +5,7 @@ */ import expect from 'expect.js'; -import { ES_INDEX_NAME, ES_TYPE_NAME } from './constants'; +import { ES_INDEX_NAME } from './constants'; export default function ({ getService }) { const supertest = getService('supertest'); @@ -21,7 +21,6 @@ export default function ({ getService }) { it('should return no configurations for the beat without tags', async () => { await es.index({ index: ES_INDEX_NAME, - type: ES_TYPE_NAME, id: `beat:empty`, body: { type: 'beat', diff --git a/x-pack/test/api_integration/apis/beats/remove_tags_from_beats.js b/x-pack/test/api_integration/apis/beats/remove_tags_from_beats.js index 999d3614451a2..1bc0664d6f80e 100644 --- a/x-pack/test/api_integration/apis/beats/remove_tags_from_beats.js +++ b/x-pack/test/api_integration/apis/beats/remove_tags_from_beats.js @@ -5,7 +5,7 @@ */ import expect from 'expect.js'; -import { ES_INDEX_NAME, ES_TYPE_NAME } from './constants'; +import { ES_INDEX_NAME } from './constants'; export default function ({ getService }) { const supertest = getService('supertest'); @@ -32,7 +32,6 @@ export default function ({ getService }) { const esResponse = await es.get({ index: ES_INDEX_NAME, - type: ES_TYPE_NAME, id: `beat:foo`, }); @@ -60,7 +59,6 @@ export default function ({ getService }) { // Beat foo esResponse = await es.get({ index: ES_INDEX_NAME, - type: ES_TYPE_NAME, id: `beat:foo`, }); @@ -70,7 +68,6 @@ export default function ({ getService }) { // Beat bar esResponse = await es.get({ index: ES_INDEX_NAME, - type: ES_TYPE_NAME, id: `beat:bar`, }); @@ -94,7 +91,6 @@ export default function ({ getService }) { const esResponse = await es.get({ index: ES_INDEX_NAME, - type: ES_TYPE_NAME, id: `beat:foo`, }); @@ -122,7 +118,6 @@ export default function ({ getService }) { // Beat foo esResponse = await es.get({ index: ES_INDEX_NAME, - type: ES_TYPE_NAME, id: `beat:foo`, }); @@ -132,7 +127,6 @@ export default function ({ getService }) { // Beat bar esResponse = await es.get({ index: ES_INDEX_NAME, - type: ES_TYPE_NAME, id: `beat:bar`, }); @@ -173,7 +167,6 @@ export default function ({ getService }) { const esResponse = await es.get({ index: ES_INDEX_NAME, - type: ES_TYPE_NAME, id: `beat:bar`, }); @@ -199,7 +192,6 @@ export default function ({ getService }) { const esResponse = await es.get({ index: ES_INDEX_NAME, - type: ES_TYPE_NAME, id: `beat:bar`, }); diff --git a/x-pack/test/api_integration/apis/beats/set_config.js b/x-pack/test/api_integration/apis/beats/set_config.js index 8169243d9e733..2c023ecbbf0ae 100644 --- a/x-pack/test/api_integration/apis/beats/set_config.js +++ b/x-pack/test/api_integration/apis/beats/set_config.js @@ -5,7 +5,7 @@ */ import expect from 'expect.js'; -import { ES_INDEX_NAME, ES_TYPE_NAME } from './constants'; +import { ES_INDEX_NAME } from './constants'; export default function ({ getService }) { const supertest = getService('supertest'); @@ -34,7 +34,6 @@ export default function ({ getService }) { .expect(201); const esResponse = await es.get({ index: ES_INDEX_NAME, - type: ES_TYPE_NAME, id: `tag:${tagId}`, }); diff --git a/x-pack/test/api_integration/apis/beats/set_tag.js b/x-pack/test/api_integration/apis/beats/set_tag.js index 5389f0dde8cd8..445f939dd80cd 100644 --- a/x-pack/test/api_integration/apis/beats/set_tag.js +++ b/x-pack/test/api_integration/apis/beats/set_tag.js @@ -5,7 +5,7 @@ */ import expect from 'expect.js'; -import { ES_INDEX_NAME, ES_TYPE_NAME } from './constants'; +import { ES_INDEX_NAME } from './constants'; export default function ({ getService }) { const supertest = getService('supertest'); @@ -24,7 +24,6 @@ export default function ({ getService }) { const esResponse = await es.get({ index: ES_INDEX_NAME, - type: ES_TYPE_NAME, id: `tag:${tagId}`, }); @@ -54,7 +53,6 @@ export default function ({ getService }) { const esResponse = await es.get({ index: ES_INDEX_NAME, - type: ES_TYPE_NAME, id: `tag:${tagId}`, }); diff --git a/x-pack/test/api_integration/apis/beats/update_beat.js b/x-pack/test/api_integration/apis/beats/update_beat.js index 163ddd931a625..ba8ed8b9631f8 100644 --- a/x-pack/test/api_integration/apis/beats/update_beat.js +++ b/x-pack/test/api_integration/apis/beats/update_beat.js @@ -5,7 +5,7 @@ */ import expect from 'expect.js'; -import { ES_INDEX_NAME, ES_TYPE_NAME } from './constants'; +import { ES_INDEX_NAME } from './constants'; import moment from 'moment'; export default function ({ getService }) { @@ -42,7 +42,6 @@ export default function ({ getService }) { await es.index({ index: ES_INDEX_NAME, - type: ES_TYPE_NAME, id: `enrollment_token:${validEnrollmentToken}`, body: { type: 'enrollment_token', @@ -69,7 +68,6 @@ export default function ({ getService }) { const beatInEs = await es.get({ index: ES_INDEX_NAME, - type: ES_TYPE_NAME, id: `beat:${beatId}`, }); @@ -94,7 +92,6 @@ export default function ({ getService }) { const beatInEs = await es.get({ index: ES_INDEX_NAME, - type: ES_TYPE_NAME, id: `beat:${beatId}`, }); diff --git a/x-pack/test/functional/es_archives/beats/list/data.json b/x-pack/test/functional/es_archives/beats/list/data.json index 49255915fb446..c2c4aba83a1c6 100644 --- a/x-pack/test/functional/es_archives/beats/list/data.json +++ b/x-pack/test/functional/es_archives/beats/list/data.json @@ -1,5 +1,4 @@ { - "type": "doc", "value": { "id": "beat:qux", "index": ".management-beats", @@ -19,7 +18,6 @@ } { - "type": "doc", "value": { "id": "beat:baz", "index": ".management-beats", @@ -39,7 +37,6 @@ } { - "type": "doc", "value": { "id": "beat:foo", "index": ".management-beats", @@ -64,7 +61,6 @@ } { - "type": "doc", "value": { "id": "beat:bar", "index": ".management-beats", @@ -84,7 +80,6 @@ } { - "type": "doc", "value": { "id": "tag:production", "index": ".management-beats", @@ -98,7 +93,6 @@ } { - "type": "doc", "value": { "id": "tag:development", "index": ".management-beats", @@ -112,7 +106,6 @@ } { - "type": "doc", "value": { "id": "tag:qa", "index": ".management-beats", @@ -126,7 +119,6 @@ } { - "type": "doc", "value": { "id": "configuration_block:SDfsdfIBdsfsf50zbta", "index": ".management-beats", @@ -145,7 +137,6 @@ } { - "type": "doc", "value": { "id": "configuration_block:W0tpsmIBdsfsf50zbta", "index": ".management-beats", @@ -163,7 +154,6 @@ } { - "type": "doc", "value": { "id": "configuration_block:W0tpsmIBdwcYyG50zbta", "index": ".management-beats",