Last active
December 1, 2020 14:56
-
-
Save lipusz/6d65c6f6c47e27006ce0feb41e5b9795 to your computer and use it in GitHub Desktop.
https://issues.liferay.com/browse/LPS-124213 ES requests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PUT liferay-20098-workflow-metrics-tasks | |
{ | |
"mappings": { | |
"date_detection": false, | |
"dynamic_templates": [ | |
{ | |
"template_ar": { | |
"mapping": { | |
"analyzer": "arabic", | |
"store": true, | |
"term_vector": "with_positions_offsets", | |
"type": "text" | |
}, | |
"match": """\w+_ar\b|\w+_ar_[A-Z]{2}\b""", | |
"match_mapping_type": "string", | |
"match_pattern": "regex" | |
} | |
}, | |
{ | |
"template_bg": { | |
"mapping": { | |
"analyzer": "bulgarian", | |
"store": true, | |
"term_vector": "with_positions_offsets", | |
"type": "text" | |
}, | |
"match": """\w+_bg\b|\w+_bg_[A-Z]{2}\b""", | |
"match_mapping_type": "string", | |
"match_pattern": "regex" | |
} | |
}, | |
{ | |
"template_ca": { | |
"mapping": { | |
"analyzer": "catalan", | |
"store": true, | |
"term_vector": "with_positions_offsets", | |
"type": "text" | |
}, | |
"match": """\w+_ca\b|\w+_ca_[A-Z]{2}\b""", | |
"match_mapping_type": "string", | |
"match_pattern": "regex" | |
} | |
}, | |
{ | |
"template_cs": { | |
"mapping": { | |
"analyzer": "czech", | |
"store": true, | |
"term_vector": "with_positions_offsets", | |
"type": "text" | |
}, | |
"match": """\w+_cs\b|\w+_cs_[A-Z]{2}\b""", | |
"match_mapping_type": "string", | |
"match_pattern": "regex" | |
} | |
}, | |
{ | |
"template_da": { | |
"mapping": { | |
"analyzer": "danish", | |
"store": true, | |
"term_vector": "with_positions_offsets", | |
"type": "text" | |
}, | |
"match": """\w+_da\b|\w+_da_[A-Z]{2}\b""", | |
"match_mapping_type": "string", | |
"match_pattern": "regex" | |
} | |
}, | |
{ | |
"template_de": { | |
"mapping": { | |
"analyzer": "german", | |
"store": true, | |
"term_vector": "with_positions_offsets", | |
"type": "text" | |
}, | |
"match": """\w+_de\b|\w+_de_[A-Z]{2}\b""", | |
"match_mapping_type": "string", | |
"match_pattern": "regex" | |
} | |
}, | |
{ | |
"template_el": { | |
"mapping": { | |
"analyzer": "greek", | |
"store": true, | |
"term_vector": "with_positions_offsets", | |
"type": "text" | |
}, | |
"match": """\w+_el\b|\w+_el_[A-Z]{2}\b""", | |
"match_mapping_type": "string", | |
"match_pattern": "regex" | |
} | |
}, | |
{ | |
"template_en": { | |
"mapping": { | |
"analyzer": "english", | |
"store": true, | |
"term_vector": "with_positions_offsets", | |
"type": "text" | |
}, | |
"match": """\w+_en\b|\w+_en_[A-Z]{2}\b""", | |
"match_mapping_type": "string", | |
"match_pattern": "regex" | |
} | |
}, | |
{ | |
"template_es": { | |
"mapping": { | |
"analyzer": "spanish", | |
"store": true, | |
"term_vector": "with_positions_offsets", | |
"type": "text" | |
}, | |
"match": """\w+_es\b|\w+_es_[A-Z]{2}\b""", | |
"match_mapping_type": "string", | |
"match_pattern": "regex" | |
} | |
}, | |
{ | |
"template_eu": { | |
"mapping": { | |
"analyzer": "basque", | |
"store": true, | |
"term_vector": "with_positions_offsets", | |
"type": "text" | |
}, | |
"match": """\w+_eu\b|\w+_eu_[A-Z]{2}\b""", | |
"match_mapping_type": "string", | |
"match_pattern": "regex" | |
} | |
}, | |
{ | |
"template_fi": { | |
"mapping": { | |
"analyzer": "finnish", | |
"store": true, | |
"term_vector": "with_positions_offsets", | |
"type": "text" | |
}, | |
"match": """\w+_fi\b|\w+_fi_[A-Z]{2}\b""", | |
"match_mapping_type": "string", | |
"match_pattern": "regex" | |
} | |
}, | |
{ | |
"template_fr": { | |
"mapping": { | |
"analyzer": "french", | |
"store": true, | |
"term_vector": "with_positions_offsets", | |
"type": "text" | |
}, | |
"match": """\w+_fr\b|\w+_fr_[A-Z]{2}\b""", | |
"match_mapping_type": "string", | |
"match_pattern": "regex" | |
} | |
}, | |
{ | |
"template_hi": { | |
"mapping": { | |
"analyzer": "hindi", | |
"store": true, | |
"term_vector": "with_positions_offsets", | |
"type": "text" | |
}, | |
"match": """\w+_hi\b|\w+_hi_[A-Z]{2}\b""", | |
"match_mapping_type": "string", | |
"match_pattern": "regex" | |
} | |
}, | |
{ | |
"template_hu": { | |
"mapping": { | |
"analyzer": "hungarian", | |
"store": true, | |
"term_vector": "with_positions_offsets", | |
"type": "text" | |
}, | |
"match": """\w+_hu\b|\w+_hu_[A-Z]{2}\b""", | |
"match_mapping_type": "string", | |
"match_pattern": "regex" | |
} | |
}, | |
{ | |
"template_hy": { | |
"mapping": { | |
"analyzer": "armenian", | |
"store": true, | |
"term_vector": "with_positions_offsets", | |
"type": "text" | |
}, | |
"match": """\w+_hy\b|\w+_hy_[A-Z]{2}\b""", | |
"match_mapping_type": "string", | |
"match_pattern": "regex" | |
} | |
}, | |
{ | |
"template_id": { | |
"mapping": { | |
"analyzer": "indonesian", | |
"store": true, | |
"term_vector": "with_positions_offsets", | |
"type": "text" | |
}, | |
"match": """\w+_id\b|\w+_id_[A-Z]{2}\b""", | |
"match_mapping_type": "string", | |
"match_pattern": "regex" | |
} | |
}, | |
{ | |
"template_it": { | |
"mapping": { | |
"analyzer": "italian", | |
"store": true, | |
"term_vector": "with_positions_offsets", | |
"type": "text" | |
}, | |
"match": """\w+_it\b|\w+_it_[A-Z]{2}\b""", | |
"match_mapping_type": "string", | |
"match_pattern": "regex" | |
} | |
}, | |
{ | |
"template_ja": { | |
"mapping": { | |
"analyzer": "kuromoji", | |
"store": true, | |
"term_vector": "with_positions_offsets", | |
"type": "text" | |
}, | |
"match": """\w+_ja\b|\w+_ja_[A-Z]{2}\b""", | |
"match_mapping_type": "string", | |
"match_pattern": "regex" | |
} | |
}, | |
{ | |
"template_ko": { | |
"mapping": { | |
"analyzer": "cjk", | |
"store": true, | |
"term_vector": "with_positions_offsets", | |
"type": "text" | |
}, | |
"match": """\w+_ko\b|\w+_ko_[A-Z]{2}\b""", | |
"match_mapping_type": "string", | |
"match_pattern": "regex" | |
} | |
}, | |
{ | |
"template_long_sortable": { | |
"mapping": { | |
"store": true, | |
"type": "long" | |
}, | |
"match": "*_sortable", | |
"match_mapping_type": "long" | |
} | |
}, | |
{ | |
"template_nl": { | |
"mapping": { | |
"analyzer": "dutch", | |
"store": true, | |
"term_vector": "with_positions_offsets", | |
"type": "text" | |
}, | |
"match": """\w+_nl\b|\w+_nl_[A-Z]{2}\b""", | |
"match_mapping_type": "string", | |
"match_pattern": "regex" | |
} | |
}, | |
{ | |
"template_no": { | |
"mapping": { | |
"analyzer": "norwegian", | |
"store": true, | |
"term_vector": "with_positions_offsets", | |
"type": "text" | |
}, | |
"match": """\w+_nb\b|\w+_nb_[A-Z]{2}\b""", | |
"match_mapping_type": "string", | |
"match_pattern": "regex" | |
} | |
}, | |
{ | |
"template_pl": { | |
"mapping": { | |
"analyzer": "polish", | |
"store": true, | |
"term_vector": "with_positions_offsets", | |
"type": "text" | |
}, | |
"match": """\w+_pl\b|\w+_pl_[A-Z]{2}\b""", | |
"match_mapping_type": "string", | |
"match_pattern": "regex" | |
} | |
}, | |
{ | |
"template_pt": { | |
"mapping": { | |
"analyzer": "portuguese", | |
"store": true, | |
"term_vector": "with_positions_offsets", | |
"type": "text" | |
}, | |
"match": """\w+_pt\b|\w+_pt_PT\b""", | |
"match_mapping_type": "string", | |
"match_pattern": "regex" | |
} | |
}, | |
{ | |
"template_pt_br": { | |
"mapping": { | |
"analyzer": "brazilian", | |
"store": true, | |
"term_vector": "with_positions_offsets", | |
"type": "text" | |
}, | |
"match": "*_pt_BR", | |
"match_mapping_type": "string" | |
} | |
}, | |
{ | |
"template_ro": { | |
"mapping": { | |
"analyzer": "romanian", | |
"store": true, | |
"term_vector": "with_positions_offsets", | |
"type": "text" | |
}, | |
"match": """\w+_ro\b|\w+_ro_RO\b""", | |
"match_mapping_type": "string", | |
"match_pattern": "regex" | |
} | |
}, | |
{ | |
"template_ru": { | |
"mapping": { | |
"analyzer": "russian", | |
"store": true, | |
"term_vector": "with_positions_offsets", | |
"type": "text" | |
}, | |
"match": """\w+_ru\b|\w+_ru_RU\b""", | |
"match_mapping_type": "string", | |
"match_pattern": "regex" | |
} | |
}, | |
{ | |
"template_string_sortable": { | |
"mapping": { | |
"normalizer": "keyword_lowercase", | |
"store": true, | |
"type": "keyword" | |
}, | |
"match": "*_sortable", | |
"match_mapping_type": "string" | |
} | |
}, | |
{ | |
"template_sv": { | |
"mapping": { | |
"analyzer": "swedish", | |
"store": true, | |
"term_vector": "with_positions_offsets", | |
"type": "text" | |
}, | |
"match": """\w+_sv\b|\w+_sv_[A-Z]{2}\b""", | |
"match_mapping_type": "string", | |
"match_pattern": "regex" | |
} | |
}, | |
{ | |
"template_th": { | |
"mapping": { | |
"analyzer": "thai", | |
"store": true, | |
"term_vector": "with_positions_offsets", | |
"type": "text" | |
}, | |
"match": """\w+_th\b|\w+_th_TH\b""", | |
"match_mapping_type": "string", | |
"match_pattern": "regex" | |
} | |
}, | |
{ | |
"template_tr": { | |
"mapping": { | |
"analyzer": "turkish", | |
"store": true, | |
"term_vector": "with_positions_offsets", | |
"type": "text" | |
}, | |
"match": """\w+_tr\b|\w+_tr_TR\b""", | |
"match_mapping_type": "string", | |
"match_pattern": "regex" | |
} | |
}, | |
{ | |
"template_zh": { | |
"mapping": { | |
"analyzer": "smartcn", | |
"store": true, | |
"term_vector": "with_positions_offsets", | |
"type": "text" | |
}, | |
"match": """\w+_zh\b|\w+_zh_[A-Z]{2}\b""", | |
"match_mapping_type": "string", | |
"match_pattern": "regex" | |
} | |
} | |
], | |
"properties": { | |
"assetTitle": { | |
"store": true, | |
"term_vector": "with_positions_offsets", | |
"type": "text" | |
}, | |
"assetType": { | |
"store": true, | |
"term_vector": "with_positions_offsets", | |
"type": "text" | |
}, | |
"assigneeIds": { | |
"store": true, | |
"type": "long" | |
}, | |
"assigneeType": { | |
"store": true, | |
"type": "keyword" | |
}, | |
"className": { | |
"store": true, | |
"type": "keyword" | |
}, | |
"classPK": { | |
"store": true, | |
"type": "long" | |
}, | |
"companyId": { | |
"store": true, | |
"type": "long" | |
}, | |
"completed": { | |
"store": true, | |
"type": "boolean" | |
}, | |
"completionDate": { | |
"format": "yyyyMMddHHmmss", | |
"store": true, | |
"type": "date" | |
}, | |
"completionUserId": { | |
"store": true, | |
"type": "long" | |
}, | |
"createDate": { | |
"format": "yyyyMMddHHmmss", | |
"store": true, | |
"type": "date" | |
}, | |
"deleted": { | |
"store": true, | |
"type": "boolean" | |
}, | |
"duration": { | |
"store": true, | |
"type": "long" | |
}, | |
"id": { | |
"store": true, | |
"type": "long" | |
}, | |
"instanceCompleted": { | |
"store": true, | |
"type": "boolean" | |
}, | |
"instanceCompletionDate": { | |
"format": "yyyyMMddHHmmss", | |
"store": true, | |
"type": "date" | |
}, | |
"instanceId": { | |
"store": true, | |
"type": "long" | |
}, | |
"modifiedDate": { | |
"format": "yyyyMMddHHmmss", | |
"store": true, | |
"type": "date" | |
}, | |
"name": { | |
"store": true, | |
"type": "keyword" | |
}, | |
"nodeId": { | |
"store": true, | |
"type": "long" | |
}, | |
"processId": { | |
"store": true, | |
"type": "long" | |
}, | |
"taskId": { | |
"store": true, | |
"type": "long" | |
}, | |
"uid": { | |
"store": true, | |
"type": "keyword" | |
}, | |
"userId": { | |
"store": true, | |
"type": "long" | |
}, | |
"version": { | |
"store": true, | |
"type": "keyword" | |
} | |
} | |
}, | |
"settings": { | |
"analysis": { | |
"normalizer": { | |
"keyword_lowercase": { | |
"filter": "lowercase" | |
} | |
} | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PUT liferay-20098-workflow-metrics-tasks/_bulk | |
{"index":{}} | |
{"companyId":20098,"completed":false,"deleted":false,"instanceCompleted":false,"instanceId":0,"name":"review","nodeId":38714,"processId":38703,"taskId":0,"uid":"WorkflowMetricsTaske99091a859345ca3ea41d7edd520bab4fe18b5a30c96929fc0969b493344ec72","version":"1.0"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PUT liferay-20098-workflow-metrics-sla-task-results | |
{ | |
"mappings": { | |
"date_detection": false, | |
"dynamic_templates": [ | |
{ | |
"template_long_sortable": { | |
"mapping": { | |
"store": true, | |
"type": "long" | |
}, | |
"match": "*_sortable", | |
"match_mapping_type": "long" | |
} | |
} | |
], | |
"properties": { | |
"assigneeIds": { | |
"store": true, | |
"type": "long" | |
}, | |
"assigneeType": { | |
"store": true, | |
"type": "keyword" | |
}, | |
"breached": { | |
"store": true, | |
"type": "boolean" | |
}, | |
"companyId": { | |
"store": true, | |
"type": "long" | |
}, | |
"completionDate": { | |
"format": "yyyyMMddHHmmss", | |
"store": true, | |
"type": "date" | |
}, | |
"completionUserId": { | |
"store": true, | |
"type": "long" | |
}, | |
"deleted": { | |
"store": true, | |
"type": "boolean" | |
}, | |
"instanceCompleted": { | |
"store": true, | |
"type": "boolean" | |
}, | |
"instanceCompletionDate": { | |
"format": "yyyyMMddHHmmss", | |
"store": true, | |
"type": "date" | |
}, | |
"instanceId": { | |
"store": true, | |
"type": "long" | |
}, | |
"lastCheckDate": { | |
"format": "yyyyMMddHHmmss", | |
"store": true, | |
"type": "date" | |
}, | |
"nodeId": { | |
"store": true, | |
"type": "long" | |
}, | |
"onTime": { | |
"store": true, | |
"type": "boolean" | |
}, | |
"processId": { | |
"store": true, | |
"type": "long" | |
}, | |
"slaDefinitionId": { | |
"store": true, | |
"type": "long" | |
}, | |
"status": { | |
"store": true, | |
"type": "keyword" | |
}, | |
"taskId": { | |
"store": true, | |
"type": "long" | |
}, | |
"taskName": { | |
"store": true, | |
"type": "keyword" | |
}, | |
"uid": { | |
"store": true, | |
"type": "keyword" | |
} | |
} | |
} | |
}, | |
"settings": { | |
"analysis": { | |
"normalizer": { | |
"keyword_lowercase": { | |
"filter": "lowercase" | |
} | |
} | |
}, | |
"index.auto_expand_replicas": "0-all", | |
"index.mapping.total_fields.limit": 7500, | |
"index.number_of_shards": 1 | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PUT liferay-20098-workflow-metrics-sla-task-results/_bulk?refresh | |
{"index":{}} | |
{"breached":false,"companyId":20098,"deleted":false,"instanceCompleted":false,"instanceId":0,"nodeId":38714,"onTime":false,"processId":38703,"slaDefinitionId":0,"taskId":0,"taskName":"review","uid":"WorkflowMetricsSLATaskResulte284e96533d9a8c3ce913df768c0f58ece716f2b06a93229e725e72eb9c80358"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
POST liferay-20098-workflow-metrics-tasks,liferay-20098-workflow-metrics-sla-task-results/_search | |
{ | |
"query": { | |
"bool": { | |
"filter": [ | |
{ | |
"bool": { | |
"should": [ | |
{ | |
"bool": { | |
"must": [ | |
{ | |
"bool": { | |
"must": [ | |
{ | |
"term": { | |
"instanceCompleted": { | |
"value": false, | |
"boost": 1 | |
} | |
} | |
}, | |
{ | |
"term": { | |
"companyId": { | |
"value": 20098, | |
"boost": 1 | |
} | |
} | |
}, | |
{ | |
"term": { | |
"deleted": { | |
"value": false, | |
"boost": 1 | |
} | |
} | |
}, | |
{ | |
"term": { | |
"processId": { | |
"value": 38703, | |
"boost": 1 | |
} | |
} | |
}, | |
{ | |
"terms": { | |
"taskName": [ | |
"review", | |
"update" | |
], | |
"boost": 1 | |
} | |
} | |
], | |
"must_not": [ | |
{ | |
"exists": { | |
"field": "completionDate", | |
"boost": 1 | |
} | |
}, | |
{ | |
"term": { | |
"status": { | |
"value": "COMPLETED", | |
"boost": 1 | |
} | |
} | |
} | |
], | |
"adjust_pure_negative": true, | |
"boost": 1 | |
} | |
} | |
], | |
"filter": [ | |
{ | |
"term": { | |
"_index": { | |
"value": "liferay-20098-workflow-metrics-sla-task-results", | |
"boost": 1 | |
} | |
} | |
} | |
], | |
"adjust_pure_negative": true, | |
"boost": 1 | |
} | |
}, | |
{ | |
"bool": { | |
"must": [ | |
{ | |
"bool": { | |
"must": [ | |
{ | |
"terms": { | |
"name": [ | |
"review", | |
"update" | |
], | |
"boost": 1 | |
} | |
}, | |
{ | |
"term": { | |
"companyId": { | |
"value": 20098, | |
"boost": 1 | |
} | |
} | |
}, | |
{ | |
"term": { | |
"completed": { | |
"value": false, | |
"boost": 1 | |
} | |
} | |
}, | |
{ | |
"term": { | |
"deleted": { | |
"value": false, | |
"boost": 1 | |
} | |
} | |
}, | |
{ | |
"term": { | |
"instanceCompleted": { | |
"value": false, | |
"boost": 1 | |
} | |
} | |
}, | |
{ | |
"term": { | |
"processId": { | |
"value": 38703, | |
"boost": 1 | |
} | |
} | |
} | |
], | |
"must_not": [ | |
{ | |
"term": { | |
"taskId": { | |
"value": "0", | |
"boost": 1 | |
} | |
} | |
} | |
], | |
"adjust_pure_negative": true, | |
"boost": 1 | |
} | |
} | |
], | |
"filter": [ | |
{ | |
"term": { | |
"_index": { | |
"value": "liferay-20098-workflow-metrics-tasks", | |
"boost": 1 | |
} | |
} | |
} | |
], | |
"adjust_pure_negative": true, | |
"boost": 1 | |
} | |
} | |
], | |
"adjust_pure_negative": true, | |
"boost": 1 | |
} | |
} | |
], | |
"adjust_pure_negative": true, | |
"boost": 1 | |
} | |
}, | |
"stored_fields": "*", | |
"aggregations": { | |
"taskName": { | |
"terms": { | |
"script": { | |
"source": "doc.containsKey('name') ? doc.name.value : doc.taskName.value", | |
"lang": "painless" | |
}, | |
"size": 2, | |
"min_doc_count": 1, | |
"shard_min_doc_count": 0, | |
"show_term_doc_count_error": false, | |
"order": [ | |
{ | |
"_count": "desc" | |
}, | |
{ | |
"_key": "asc" | |
} | |
] | |
}, | |
"aggregations": { | |
"breached": { | |
"filter": { | |
"bool": { | |
"must": [ | |
{ | |
"term": { | |
"instanceCompleted": { | |
"value": false, | |
"boost": 1 | |
} | |
} | |
} | |
], | |
"must_not": [ | |
{ | |
"term": { | |
"status": { | |
"value": "NEW", | |
"boost": 1 | |
} | |
} | |
} | |
], | |
"adjust_pure_negative": true, | |
"boost": 1 | |
} | |
}, | |
"aggregations": { | |
"breachedInstanceCount": { | |
"scripted_metric": { | |
"init_script": { | |
"source": """state.breachedMap = new HashMap(); | |
state.onTimeMap = new HashMap();""", | |
"lang": "painless" | |
}, | |
"map_script": { | |
"source": """def instanceId = doc.instanceId.value; | |
if (doc.uid.value.startsWith("WorkflowMetricsSLAInstanceResult") && | |
(instanceId != 0) && (doc.elapsedTime.value != 0)) { | |
state.onTimeMap.merge( | |
instanceId, doc.onTime.value, | |
(onTime1, onTime2) -> (onTime1 && onTime2)); | |
} | |
else if (doc.uid.value.startsWith("WorkflowMetricsSLATaskResult") && | |
(instanceId != 0)) { | |
state.onTimeMap.merge( | |
instanceId, doc.onTime.value, | |
(onTime1, onTime2) -> (onTime1 && onTime2)); | |
} | |
if (doc.uid.value.startsWith("WorkflowMetricsSLATaskResult")) { | |
state.breachedMap.merge( | |
instanceId, doc.breached.value, | |
(breached1, breached2) -> (breached1 || breached2)); | |
}""", | |
"lang": "painless" | |
}, | |
"combine_script": { | |
"source": "return state;", | |
"lang": "painless" | |
}, | |
"reduce_script": { | |
"source": """def breachedMap = new HashMap(); | |
for (state in states) { | |
if (state == null) { | |
continue; | |
} | |
for (entry in state.breachedMap.entrySet()) { | |
breachedMap.merge( | |
entry.key, entry.value, | |
(breached1, breached2) -> breached1 || breached2); | |
} | |
} | |
def instanceCount = 0; | |
for (breached in breachedMap.entrySet()) { | |
if (breached.value == true) { | |
instanceCount += 1; | |
} | |
} | |
return instanceCount;""", | |
"lang": "painless" | |
}, | |
"params": {} | |
} | |
} | |
} | |
}, | |
"countFilter": { | |
"filter": { | |
"bool": { | |
"must": [ | |
{ | |
"term": { | |
"instanceCompleted": { | |
"value": false, | |
"boost": 1 | |
} | |
} | |
} | |
], | |
"filter": [ | |
{ | |
"term": { | |
"_index": { | |
"value": "liferay-20098-workflow-metrics-tasks", | |
"boost": 1 | |
} | |
} | |
} | |
], | |
"must_not": [ | |
{ | |
"term": { | |
"instanceId": { | |
"value": 0, | |
"boost": 1 | |
} | |
} | |
} | |
], | |
"adjust_pure_negative": true, | |
"boost": 1 | |
} | |
}, | |
"aggregations": { | |
"durationAvg": { | |
"avg": { | |
"field": "duration" | |
} | |
}, | |
"instanceCount": { | |
"value_count": { | |
"field": "instanceId" | |
} | |
} | |
} | |
}, | |
"onTime": { | |
"filter": { | |
"bool": { | |
"must": [ | |
{ | |
"term": { | |
"instanceCompleted": { | |
"value": false, | |
"boost": 1 | |
} | |
} | |
} | |
], | |
"must_not": [ | |
{ | |
"term": { | |
"status": { | |
"value": "NEW", | |
"boost": 1 | |
} | |
} | |
} | |
], | |
"adjust_pure_negative": true, | |
"boost": 1 | |
} | |
}, | |
"aggregations": { | |
"instanceCount": { | |
"scripted_metric": { | |
"init_script": { | |
"source": """state.breachedMap = new HashMap(); | |
state.onTimeMap = new HashMap();""", | |
"lang": "painless" | |
}, | |
"map_script": { | |
"source": """def instanceId = doc.instanceId.value; | |
if (doc.uid.value.startsWith("WorkflowMetricsSLAInstanceResult") && | |
(instanceId != 0) && (doc.elapsedTime.value != 0)) { | |
state.onTimeMap.merge( | |
instanceId, doc.onTime.value, | |
(onTime1, onTime2) -> (onTime1 && onTime2)); | |
} | |
else if (doc.uid.value.startsWith("WorkflowMetricsSLATaskResult") && | |
(instanceId != 0)) { | |
state.onTimeMap.merge( | |
instanceId, doc.onTime.value, | |
(onTime1, onTime2) -> (onTime1 && onTime2)); | |
} | |
if (doc.uid.value.startsWith("WorkflowMetricsSLATaskResult")) { | |
state.breachedMap.merge( | |
instanceId, doc.breached.value, | |
(breached1, breached2) -> (breached1 || breached2)); | |
}""", | |
"lang": "painless" | |
}, | |
"combine_script": { | |
"source": "return state;", | |
"lang": "painless" | |
}, | |
"reduce_script": { | |
"source": """def onTimeMap = new HashMap(); | |
for (state in states) { | |
if (state == null) { | |
continue; | |
} | |
for (entry in state.onTimeMap.entrySet()) { | |
onTimeMap.merge( | |
entry.key, entry.value, (onTime1, onTime2) -> onTime1 && onTime2); | |
} | |
} | |
def instanceCount = 0; | |
for (onTime in onTimeMap.entrySet()) { | |
if (onTime.value == true) { | |
instanceCount += 1; | |
} | |
} | |
return instanceCount;""", | |
"lang": "painless" | |
}, | |
"params": {} | |
} | |
} | |
} | |
}, | |
"overdue": { | |
"filter": { | |
"bool": { | |
"must": [ | |
{ | |
"term": { | |
"instanceCompleted": { | |
"value": false, | |
"boost": 1 | |
} | |
} | |
} | |
], | |
"must_not": [ | |
{ | |
"term": { | |
"status": { | |
"value": "NEW", | |
"boost": 1 | |
} | |
} | |
} | |
], | |
"adjust_pure_negative": true, | |
"boost": 1 | |
} | |
}, | |
"aggregations": { | |
"instanceCount": { | |
"scripted_metric": { | |
"init_script": { | |
"source": """state.breachedMap = new HashMap(); | |
state.onTimeMap = new HashMap();""", | |
"lang": "painless" | |
}, | |
"map_script": { | |
"source": """def instanceId = doc.instanceId.value; | |
if (doc.uid.value.startsWith("WorkflowMetricsSLAInstanceResult") && | |
(instanceId != 0) && (doc.elapsedTime.value != 0)) { | |
state.onTimeMap.merge( | |
instanceId, doc.onTime.value, | |
(onTime1, onTime2) -> (onTime1 && onTime2)); | |
} | |
else if (doc.uid.value.startsWith("WorkflowMetricsSLATaskResult") && | |
(instanceId != 0)) { | |
state.onTimeMap.merge( | |
instanceId, doc.onTime.value, | |
(onTime1, onTime2) -> (onTime1 && onTime2)); | |
} | |
if (doc.uid.value.startsWith("WorkflowMetricsSLATaskResult")) { | |
state.breachedMap.merge( | |
instanceId, doc.breached.value, | |
(breached1, breached2) -> (breached1 || breached2)); | |
}""", | |
"lang": "painless" | |
}, | |
"combine_script": { | |
"source": "return state;", | |
"lang": "painless" | |
}, | |
"reduce_script": { | |
"source": """def onTimeMap = new HashMap(); | |
for (state in states) { | |
if (state == null) { | |
continue; | |
} | |
for (entry in state.onTimeMap.entrySet()) { | |
onTimeMap.merge( | |
entry.key, entry.value, (onTime1, onTime2) -> onTime1 && onTime2); | |
} | |
} | |
def instanceCount = 0; | |
for (onTime in onTimeMap.entrySet()) { | |
if (onTime.value == false) { | |
instanceCount += 1; | |
} | |
} | |
return instanceCount;""", | |
"lang": "painless" | |
}, | |
"params": {} | |
} | |
} | |
} | |
}, | |
"breachedInstancePercentage": { | |
"bucket_script": { | |
"buckets_path": { | |
"instanceCount": "countFilter>instanceCount.value", | |
"breachedInstanceCount": "breached>breachedInstanceCount.value" | |
}, | |
"script": { | |
"source": """if (params.instanceCount == 0) { | |
return 0.0; | |
} | |
return (params.breachedInstanceCount / params.instanceCount) * 100""", | |
"lang": "painless" | |
}, | |
"gap_policy": "skip" | |
} | |
}, | |
"sort": { | |
"bucket_sort": { | |
"sort": [ | |
{ | |
"overdue>instanceCount.value": { | |
"order": "asc", | |
"unmapped_type": "keyword" | |
} | |
}, | |
{ | |
"_key": { | |
"order": "asc", | |
"unmapped_type": "keyword" | |
} | |
} | |
], | |
"from": 0, | |
"size": 5, | |
"gap_policy": "INSERT_ZEROS" | |
} | |
} | |
} | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Caused by: org.elasticsearch.transport.ResponseHandlerFailureTransportException: java.lang.ClassCastException: class java.lang.Long cannot be cast to class java.lang.String (java.lang.Long and java.lang.String are in module java.base of loader 'bootstrap') | |
Caused by: java.lang.ClassCastException: class java.lang.Long cannot be cast to class java.lang.String (java.lang.Long and java.lang.String are in module java.base of loader 'bootstrap') | |
at org.elasticsearch.common.io.stream.StreamOutput.lambda$static$14(StreamOutput.java:730) ~[elasticsearch-7.10.0.jar:7.10.0] | |
at org.elasticsearch.common.io.stream.StreamOutput.writeGenericValue(StreamOutput.java:846) ~[elasticsearch-7.10.0.jar:7.10.0] | |
at org.elasticsearch.common.io.stream.StreamOutput.lambda$static$14(StreamOutput.java:731) ~[elasticsearch-7.10.0.jar:7.10.0] | |
at org.elasticsearch.common.io.stream.StreamOutput.writeGenericValue(StreamOutput.java:846) ~[elasticsearch-7.10.0.jar:7.10.0] | |
at org.elasticsearch.common.io.stream.StreamOutput.writeCollection(StreamOutput.java:1203) ~[elasticsearch-7.10.0.jar:7.10.0] | |
at org.elasticsearch.search.aggregations.metrics.InternalScriptedMetric.doWriteTo(InternalScriptedMetric.java:79) ~[elasticsearch-7.10.0.jar:7.10.0] | |
at org.elasticsearch.search.aggregations.InternalAggregation.writeTo(InternalAggregation.java:202) ~[elasticsearch-7.10.0.jar:7.10.0] | |
at org.elasticsearch.common.io.stream.StreamOutput.writeNamedWriteable(StreamOutput.java:1115) ~[elasticsearch-7.10.0.jar:7.10.0] | |
at org.elasticsearch.common.io.stream.StreamOutput.writeNamedWriteableList(StreamOutput.java:1240) ~[elasticsearch-7.10.0.jar:7.10.0] | |
at org.elasticsearch.search.aggregations.InternalAggregations.writeTo(InternalAggregations.java:128) ~[elasticsearch-7.10.0.jar:7.10.0] | |
at org.elasticsearch.search.aggregations.bucket.InternalSingleBucketAggregation.doWriteTo(InternalSingleBucketAggregation.java:73) ~[elasticsearch-7.10.0.jar:7.10.0] | |
at org.elasticsearch.search.aggregations.InternalAggregation.writeTo(InternalAggregation.java:202) ~[elasticsearch-7.10.0.jar:7.10.0] | |
at org.elasticsearch.common.io.stream.StreamOutput.writeNamedWriteable(StreamOutput.java:1115) ~[elasticsearch-7.10.0.jar:7.10.0] | |
at org.elasticsearch.common.io.stream.StreamOutput.writeNamedWriteableList(StreamOutput.java:1240) ~[elasticsearch-7.10.0.jar:7.10.0] | |
at org.elasticsearch.search.aggregations.InternalAggregations.writeTo(InternalAggregations.java:128) ~[elasticsearch-7.10.0.jar:7.10.0] | |
at org.elasticsearch.search.aggregations.bucket.terms.InternalTerms$Bucket.writeTo(InternalTerms.java:104) ~[elasticsearch-7.10.0.jar:7.10.0] | |
at org.elasticsearch.common.io.stream.StreamOutput.lambda$writeCollection$34(StreamOutput.java:1184) ~[elasticsearch-7.10.0.jar:7.10.0] | |
at org.elasticsearch.common.io.stream.StreamOutput.writeCollection(StreamOutput.java:1203) ~[elasticsearch-7.10.0.jar:7.10.0] | |
at org.elasticsearch.common.io.stream.StreamOutput.writeCollection(StreamOutput.java:1184) ~[elasticsearch-7.10.0.jar:7.10.0] | |
at org.elasticsearch.common.io.stream.StreamOutput.writeList(StreamOutput.java:1191) ~[elasticsearch-7.10.0.jar:7.10.0] | |
at org.elasticsearch.search.aggregations.bucket.terms.InternalMappedTerms.writeTermTypeInfoTo(InternalMappedTerms.java:80) ~[elasticsearch-7.10.0.jar:7.10.0] | |
at org.elasticsearch.search.aggregations.bucket.terms.InternalTerms.doWriteTo(InternalTerms.java:213) ~[elasticsearch-7.10.0.jar:7.10.0] | |
at org.elasticsearch.search.aggregations.InternalAggregation.writeTo(InternalAggregation.java:202) ~[elasticsearch-7.10.0.jar:7.10.0] | |
at org.elasticsearch.common.io.stream.StreamOutput.writeNamedWriteable(StreamOutput.java:1115) ~[elasticsearch-7.10.0.jar:7.10.0] | |
at org.elasticsearch.common.io.stream.StreamOutput.writeNamedWriteableList(StreamOutput.java:1240) ~[elasticsearch-7.10.0.jar:7.10.0] | |
at org.elasticsearch.search.aggregations.InternalAggregations.writeTo(InternalAggregations.java:128) ~[elasticsearch-7.10.0.jar:7.10.0] | |
at org.elasticsearch.common.io.stream.DelayableWriteable$Referencing.writeToBuffer(DelayableWriteable.java:119) ~[elasticsearch-7.10.0.jar:7.10.0] | |
at org.elasticsearch.common.io.stream.DelayableWriteable$Referencing.asSerialized(DelayableWriteable.java:104) ~[elasticsearch-7.10.0.jar:7.10.0] | |
at org.elasticsearch.action.search.QueryPhaseResultConsumer$PendingMerges.ramBytesUsedQueryResult(QueryPhaseResultConsumer.java:294) ~[elasticsearch-7.10.0.jar:7.10.0] | |
at org.elasticsearch.action.search.QueryPhaseResultConsumer$PendingMerges.consume(QueryPhaseResultConsumer.java:334) ~[elasticsearch-7.10.0.jar:7.10.0] | |
at org.elasticsearch.action.search.QueryPhaseResultConsumer.consumeResult(QueryPhaseResultConsumer.java:120) ~[elasticsearch-7.10.0.jar:7.10.0] | |
at org.elasticsearch.action.search.AbstractSearchAsyncAction.onShardResult(AbstractSearchAsyncAction.java:474) [elasticsearch-7.10.0.jar:7.10.0] | |
at org.elasticsearch.action.search.SearchQueryThenFetchAsyncAction.onShardResult(SearchQueryThenFetchAsyncAction.java:109) ~[elasticsearch-7.10.0.jar:7.10.0] | |
at org.elasticsearch.action.search.AbstractSearchAsyncAction$1.innerOnResponse(AbstractSearchAsyncAction.java:249) ~[elasticsearch-7.10.0.jar:7.10.0] | |
at org.elasticsearch.action.search.SearchActionListener.onResponse(SearchActionListener.java:45) ~[elasticsearch-7.10.0.jar:7.10.0] | |
at org.elasticsearch.action.search.SearchActionListener.onResponse(SearchActionListener.java:29) ~[elasticsearch-7.10.0.jar:7.10.0] | |
at org.elasticsearch.action.search.SearchExecutionStatsCollector.onResponse(SearchExecutionStatsCollector.java:68) ~[elasticsearch-7.10.0.jar:7.10.0] | |
at org.elasticsearch.action.search.SearchExecutionStatsCollector.onResponse(SearchExecutionStatsCollector.java:36) ~[elasticsearch-7.10.0.jar:7.10.0] | |
at org.elasticsearch.action.ActionListenerResponseHandler.handleResponse(ActionListenerResponseHandler.java:54) ~[elasticsearch-7.10.0.jar:7.10.0] | |
at org.elasticsearch.action.search.SearchTransportService$ConnectionCountingHandler.handleResponse(SearchTransportService.java:399) ~[elasticsearch-7.10.0.jar:7.10.0] | |
at org.elasticsearch.transport.TransportService$6.handleResponse(TransportService.java:634) ~[elasticsearch-7.10.0.jar:7.10.0] | |
at org.elasticsearch.transport.TransportService$ContextRestoreResponseHandler.handleResponse(TransportService.java:1171) ~[elasticsearch-7.10.0.jar:7.10.0] | |
at org.elasticsearch.transport.TransportService$DirectResponseChannel.processResponse(TransportService.java:1249) ~[elasticsearch-7.10.0.jar:7.10.0] | |
... 13 more |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment