Skip to content

Commit

Permalink
[BeatsCM] remove type from ES template and requests (elastic#30549) (e…
Browse files Browse the repository at this point in the history
…lastic#30823) (elastic#31116)

* remove dype from ES template and requests

* remove doc type?
  • Loading branch information
mattapperson authored Feb 14, 2019
1 parent db8c3e9 commit 02c8dc9
Show file tree
Hide file tree
Showing 18 changed files with 137 additions and 238 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"index_patterns": [".management-beats"],
"version": 67000,
"version": 70000,
"settings": {
"index": {
"number_of_shards": 1,
Expand All @@ -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"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -46,7 +45,6 @@ export class ElasticsearchBeatsAdapter implements CMBeatsAdapter {
id: `beat:${beat.id}`,
index: INDEX_NAMES.BEATS,
refresh: 'wait_for',
type: '_doc',
});
}

Expand All @@ -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);
}
Expand All @@ -74,7 +71,6 @@ export class ElasticsearchBeatsAdapter implements CMBeatsAdapter {
ids,
},
index: INDEX_NAMES.BEATS,
type: '_doc',
};
const response = await this.database.mget(user, params);

Expand All @@ -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 },
Expand Down Expand Up @@ -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 },
Expand All @@ -140,7 +134,6 @@ export class ElasticsearchBeatsAdapter implements CMBeatsAdapter {
index: INDEX_NAMES.BEATS,
size: 10000,
ignore: [404],
type: '_doc',
body: {
query: {
bool: {
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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) => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}`),
},
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -123,7 +120,6 @@ export class ElasticsearchConfigurationBlockAdapter implements ConfigurationBloc
},
},
index: INDEX_NAMES.BEATS,
type: '_doc',
});

if (result.failures.length > 0) {
Expand Down Expand Up @@ -156,7 +152,6 @@ export class ElasticsearchConfigurationBlockAdapter implements ConfigurationBloc
body,
index: INDEX_NAMES.BEATS,
refresh: 'wait_for',
type: '_doc',
});

if (result.errors) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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);

Expand Down
Loading

0 comments on commit 02c8dc9

Please sign in to comment.