kibana - Unable to drop result bucket in terms aggregation - Elasticsearch -


i have documents in elasticsearch following structure:

   "mappings": {   "document": {     "properties": {       "@timestamp": {         "type": "date",         "format": "strict_date_optional_time||epoch_millis"       },       "@version": {         "type": "string"       },       "id_secuencia": {         "type": "long"       },       "event": {         "properties": {           "elapsedtime": {             "type": "double"           },           "requesttime": {             "type": "date",             "format": "strict_date_optional_time||epoch_millis"           },           "error": {             "properties": {               "errorcode": {                 "type": "string",                 "index": "not_analyzed"               },               "failuredetail": {                 "type": "string"               },               "fault": {                 "type": "string"               }             }           },           "file": {             "type": "string",             "index": "not_analyzed"           },           "messageid": {             "type": "string"           },           "request": {             "properties": {               "body": {                 "type": "string"               },               "header": {                 "type": "string"               }             }           },           "responsetime": {             "type": "date",             "format": "strict_date_optional_time||epoch_millis"           },           "service": {             "properties": {               "operation": {                 "type": "string",                 "index": "not_analyzed"               },               "project": {                 "type": "string",                 "index": "not_analyzed"               },               "proxy": {                 "type": "string",                 "index": "not_analyzed"               },               "version": {                 "type": "string",                 "index": "not_analyzed"               }             }           },           "timestamp": {             "type": "date",             "format": "strict_date_optional_time||epoch_millis"           },           "user": {             "type": "string",             "index": "not_analyzed"           }         }       },       "type": {         "type": "string"       }     }   } } 

and need retrieve list of unique values field "event.file" (to show in kibana data table) according following criteria:

  • there more 1 document same value field "event.file"

  • all occurences value of "event.file" have resulted in error (field "event.error.errorcode" exists in documents)

for purpose approach i've been testing use of terms aggregation, can list of buckets documents single file name. haven't been able achieve drop of resulting buckets in aggregation according previous criteria (if @ least 1 of them not have error bucket should discarded).

is correct approach or there better/easier way type of result?

thanks lot.

after trying out several queries found following approach (see query below) valid purpose. problem see apparently not possible in kibana, has no support pipeline aggregations (see https://github.com/elastic/kibana/issues/4584).

{   "query": {     "bool": {       "must": [         {           "filtered": {             "filter": {               "exists": {                 "field": "event.file"               }             }           }         }       ]     }   },   "size": 0,   "aggs": {     "file-events": {       "terms": {         "field": "event.file",         "size": 0,         "min_doc_count": 2       },       "aggs": {         "files": {           "filter": {             "exists": {               "field": "event.file"             }           },           "aggs": {             "totalfiles": {               "value_count": {                 "field": "event.file"               }             }           }         },         "errors": {           "filter": {             "exists": {               "field": "event.error.errorcode"             }           },           "aggs": {             "totalerrors": {               "value_count": {                 "field": "event.error.errorcode"               }             }           }         },         "exhausted": {           "bucket_selector": {             "buckets_path": {               "total_files":"files>totalfiles",               "total_errors":"errors>totalerrors"             },             "script": "total_errors == total_files"           }         }       }     }   } } 

again, if i'm missing feedback appreciated :)


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -