Skip to content
This repository was archived by the owner on Dec 14, 2022. It is now read-only.

Commit 8eaae2e

Browse files
author
Chris Wiechmann
committed
serviceId is still a keyword - serviceId.text is now an indexed text
1 parent d3ca8a7 commit 8eaae2e

File tree

4 files changed

+26
-26
lines changed

4 files changed

+26
-26
lines changed

apibuilder4elastic/custom_flow_nodes/api-builder-plugin-axway-api-management/src/actions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ async function _getTopology(requestHeaders) {
464464
return response.body.result;
465465
})
466466
.catch(err => {
467-
throw new Error(`Error getting API-Gateway topology user. Request sent to: '${pluginConfig.apigateway.url}'. Response-Code: ${err.statusCode}`);
467+
throw new Error(`Error getting API-Gateway topology from Admin-Node-Manager. Request sent to: '${pluginConfig.apigateway.url}'. Response-Code: ${err.statusCode}`);
468468
});
469469
return topology;
470470
}

apibuilder4elastic/custom_flow_nodes/api-builder-plugin-traffic-monitor-api-utils/src/actions.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -386,27 +386,27 @@ async function addServiceIdFilter(filters, serviceID, gatewayTopology, logger) {
386386
if(!includeOtherServiceIDs) {
387387
// For classic mode, we simply include the serviceId
388388
logger.debug(`Request for serviceId: ${serviceID} is NOT including other serviceIDs.`);
389-
filters.mustFilters.push({ "term": { "processInfo.serviceId.keyword": serviceID } });
389+
filters.mustFilters.push({ "term": { "processInfo.serviceId": serviceID } });
390390
} else {
391-
logger.debug(`Request for serviceId: ${serviceID} is including other serviceIDs.`);
391+
logger.info(`EMT-Mode - Request for serviceId: ${serviceID} is including other serviceIDs.`);
392392
// Include a wildcard for all services no longer active
393393
filters.mustFilters.push( { "bool": {
394394
// Should turns into an OR condition
395395
"should": [ {
396396
// Include the serviceId given
397-
"term": { "processInfo.serviceId.keyword": serviceID }
397+
"term": { "processInfo.serviceId": serviceID }
398398
},
399399
// And all other services
400400
{
401-
"match": { "processInfo.serviceId": prefix }
401+
"match": { "processInfo.serviceId.text": prefix }
402402
}
403403
]
404404
} });
405405
// But ignore all other Service-IDs which are still active, as they are handled by a separate dedicated request for this service-ID
406406
gatewayTopology.services.forEach(function (service) {
407407
if(service.id.startsWith(prefix) && service.id!=serviceID) {
408-
logger.info(`EMT-Mode - Exclude serviceID: ${service.id}`);
409-
filters.mustNotFilters.push({ "term": { "processInfo.serviceId.keyword": service.id } });
408+
logger.info(`EMT-Mode - Exclude serviceID: ${service.id} as it handled by another request.`);
409+
filters.mustNotFilters.push({ "term": { "processInfo.serviceId": service.id } });
410410
}
411411
});
412412
}

apibuilder4elastic/custom_flow_nodes/api-builder-plugin-traffic-monitor-api-utils/test/testHandleFilterQueries.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ describe('flow-node traffic-monitor-api-utils', () => {
4646
expect(value).to.deep.equal({ "bool": { "must": [
4747
{"match": {"http.uri": { "query": "/v2/pet/findByStatus", "operator": "and" }}},
4848
{"exists": {"field": "http"}},
49-
{"term": {"processInfo.serviceId.keyword": "instance-1"}}
49+
{"term": {"processInfo.serviceId": "instance-1"}}
5050
]}});
5151
});
5252

@@ -59,7 +59,7 @@ describe('flow-node traffic-monitor-api-utils', () => {
5959
expect(value).to.deep.equal({ "bool": { "must": [
6060
{"match": {"http.sslSubject": { "query": "/CN=*.ngrok.io" }}},
6161
{"exists": {"field": "http"}},
62-
{"term": {"processInfo.serviceId.keyword": "instance-1"}}
62+
{"term": {"processInfo.serviceId": "instance-1"}}
6363
]}});
6464
});
6565

@@ -73,7 +73,7 @@ describe('flow-node traffic-monitor-api-utils', () => {
7373
{"match": {"http.uri": { "query": "/v2/pet/findByStatus", "operator": "and" }}},
7474
{"match": {"http.method": { "query": "GET" }}},
7575
{"exists": {"field": "http"}},
76-
{"term": {"processInfo.serviceId.keyword": "instance-1"}}
76+
{"term": {"processInfo.serviceId": "instance-1"}}
7777
]}});
7878
});
7979

@@ -85,7 +85,7 @@ describe('flow-node traffic-monitor-api-utils', () => {
8585
expect(value).to.be.a('object');
8686
expect(value).to.deep.equal({ "bool": { "must": [
8787
{ exists: { "field": "http"} },
88-
{ term: {"processInfo.serviceId.keyword": "instance-1"}},
88+
{ term: {"processInfo.serviceId": "instance-1"}},
8989
{ range: { "duration": { "gte": "100" } } }
9090
]}});
9191
});
@@ -109,7 +109,7 @@ describe('flow-node traffic-monitor-api-utils', () => {
109109

110110
expect(value).to.deep.equal({ "bool": { "must": [
111111
{ exists: { "field": "http"} },
112-
{ term: {"processInfo.serviceId.keyword": "instance-1"}},
112+
{ term: {"processInfo.serviceId": "instance-1"}},
113113
{ range: { "@timestamp": { "gte": "1607010000000", "lte": "16070900000000" } } }
114114
]}});
115115
});
@@ -125,7 +125,7 @@ describe('flow-node traffic-monitor-api-utils', () => {
125125
expect(value).to.deep.equal({ "bool": { "must": [
126126
{"match": {"fileTransfer.serviceType": { "query": "ftps" }}},
127127
{"exists": {"field": "fileTransfer"}},
128-
{"term": {"processInfo.serviceId.keyword": "instance-1"}}
128+
{"term": {"processInfo.serviceId": "instance-1"}}
129129
]}});
130130
});
131131

@@ -138,7 +138,7 @@ describe('flow-node traffic-monitor-api-utils', () => {
138138
expect(value).to.deep.equal({ "bool": { "must": [
139139
{ range: {"http.status": { "gte": 200, "lte": 200 }}},
140140
{ exists: { "field": "http"} },
141-
{ term: {"processInfo.serviceId.keyword": "instance-1"}}
141+
{ term: {"processInfo.serviceId": "instance-1"}}
142142
]}});
143143
});
144144

@@ -151,7 +151,7 @@ describe('flow-node traffic-monitor-api-utils', () => {
151151
expect(value).to.deep.equal({ "bool": { "must": [
152152
{ range: {"http.status": { "gte": 200, "lte": 299 }}},
153153
{ exists: { "field": "http"} },
154-
{ term: {"processInfo.serviceId.keyword": "instance-1"}}
154+
{ term: {"processInfo.serviceId": "instance-1"}}
155155
]}});
156156
});
157157

@@ -164,7 +164,7 @@ describe('flow-node traffic-monitor-api-utils', () => {
164164
expect(value).to.deep.equal({ "bool":
165165
{ "must": [
166166
{ exists: { "field": "http"} },
167-
{ term: {"processInfo.serviceId.keyword": "instance-1"}}
167+
{ term: {"processInfo.serviceId": "instance-1"}}
168168
],
169169
"must_not": [
170170
{ range: {"http.status": { "gte": 200, "lte": 200 }}},
@@ -181,7 +181,7 @@ describe('flow-node traffic-monitor-api-utils', () => {
181181
expect(value).to.deep.equal({ "bool":
182182
{ "must": [
183183
{ exists: { "field": "http"} },
184-
{ term: {"processInfo.serviceId.keyword": "instance-1"}}
184+
{ term: {"processInfo.serviceId": "instance-1"}}
185185
],
186186
"must_not": [
187187
{ range: {"http.status": { "gte": 200, "lte": 299 }}}
@@ -218,20 +218,20 @@ describe('flow-node traffic-monitor-api-utils', () => {
218218
{"bool": {
219219
"should": [
220220
{
221-
"term": { "processInfo.serviceId.keyword": "traffic-7cb4f6989f-first"}
221+
"term": { "processInfo.serviceId": "traffic-7cb4f6989f-first"}
222222
},
223223
{
224-
"match": { "processInfo.serviceId": "traffic-" }
224+
"match": { "processInfo.serviceId.text": "traffic-" }
225225
}
226226
] }
227227
}
228228
],
229229
"must_not": [
230230
{
231-
"term": { "processInfo.serviceId.keyword": "traffic-7cb4f6989f-second" }
231+
"term": { "processInfo.serviceId": "traffic-7cb4f6989f-second" }
232232
},
233233
{
234-
"term": { "processInfo.serviceId.keyword": "traffic-7cb4f6989f-third" }
234+
"term": { "processInfo.serviceId": "traffic-7cb4f6989f-third" }
235235
}
236236
]
237237
}});
@@ -247,7 +247,7 @@ describe('flow-node traffic-monitor-api-utils', () => {
247247
expect(value).to.deep.equal({ "bool": {
248248
"must": [
249249
{"exists": {"field": "http"}},
250-
{ term: {"processInfo.serviceId.keyword": "traffic-7cb4f6989f-second"}}
250+
{ term: {"processInfo.serviceId": "traffic-7cb4f6989f-second"}}
251251
]
252252
}});
253253
});

apibuilder4elastic/elasticsearch_config/traffic-summary/index_template.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": 6,
2+
"version": 7,
33
"index_patterns": [
44
"apigw-traffic-summary-*"
55
],
@@ -31,10 +31,10 @@
3131
"norms": false
3232
},
3333
"processInfo.serviceId": {
34-
"type": "text",
34+
"type": "keyword",
3535
"fields": {
36-
"keyword": {
37-
"type": "keyword"
36+
"text": {
37+
"type": "text"
3838
}
3939
},
4040
"norms": false

0 commit comments

Comments
 (0)