mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
* remove dype from ES template and requests * remove doc type?
This commit is contained in:
parent
db8c3e9832
commit
02c8dc95c7
18 changed files with 137 additions and 238 deletions
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<any>(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<any>(response, 'items', []).map((item: any, resultIdx: any) => ({
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -97,7 +97,6 @@ export interface DatabaseSearchResponse<T> {
|
|||
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<Source> {
|
||||
_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<T> {
|
||||
|
@ -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<T> 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;
|
||||
|
|
|
@ -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<any>(response, 'hits.hits', []);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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`,
|
||||
});
|
||||
|
||||
|
|
|
@ -5,4 +5,3 @@
|
|||
*/
|
||||
|
||||
export const ES_INDEX_NAME = '.management-beats';
|
||||
export const ES_TYPE_NAME = '_doc';
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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`,
|
||||
});
|
||||
|
||||
|
|
|
@ -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}`,
|
||||
});
|
||||
|
||||
|
|
|
@ -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}`,
|
||||
});
|
||||
|
||||
|
|
|
@ -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}`,
|
||||
});
|
||||
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue