Skip to content

Instantly share code, notes, and snippets.

@alpgarcia
Last active February 19, 2020 10:48
Show Gist options
  • Save alpgarcia/506020126d99f357f22506be7b38c079 to your computer and use it in GitHub Desktop.
Save alpgarcia/506020126d99f357f22506be7b38c079 to your computer and use it in GitHub Desktop.
Others management in OpenDistro 1.3.0 (Based on ES+Kibana 7.3.2)
  • MAIN QUERY:
{
  "index": "git_enrich",
  "ignore_unavailable": true,
  "preference": 1582107058298
} {
  "aggs": {
    "2": {
      "terms": {
        "field": "author_domain",
        "order": {
          "1": "desc"
        },
        "size": 2
      },
      "aggs": {
        "1": {
          "cardinality": {
            "field": "author_uuid"
          }
        }
      }
    }
  },
  "size": 0,
  "_source": {
    "excludes": []
  },
  "stored_fields": ["*"],
  "script_fields": {},
  "docvalue_fields": [{
    "field": "author_date",
    "format": "date_time"
  }, {
    "field": "commit_date",
    "format": "date_time"
  }, {
    "field": "demography_max_date",
    "format": "date_time"
  }, {
    "field": "demography_min_date",
    "format": "date_time"
  }, {
    "field": "grimoire_creation_date",
    "format": "date_time"
  }, {
    "field": "metadata__enriched_on",
    "format": "date_time"
  }, {
    "field": "metadata__timestamp",
    "format": "date_time"
  }, {
    "field": "metadata__updated_on",
    "format": "date_time"
  }, {
    "field": "utc_author",
    "format": "date_time"
  }, {
    "field": "utc_commit",
    "format": "date_time"
  }],
  "query": {
    "bool": {
      "must": [{
        "range": {
          "grimoire_creation_date": {
            "format": "strict_date_optional_time",
            "gte": "2014-02-19T10:23:37.619Z",
            "lte": "2020-02-19T10:23:37.619Z"
          }
        }
      }],
      "filter": [{
        "match_all": {}
      }],
      "should": [],
      "must_not": []
    }
  },
  "timeout": "30000ms"
}
  • MAIN RESPONSE:
{
  "took": 50,
  "responses": [{
    "took": 49,
    "timed_out": false,
    "_shards": {
      "total": 1,
      "successful": 1,
      "skipped": 0,
      "failed": 0
    },
    "hits": {
      "total": 84681,
      "max_score": null,
      "hits": []
    },
    "aggregations": {
      "2": {
        "doc_count_error_upper_bound": -1,
        "sum_other_doc_count": 52327,
        "buckets": [{
          "1": {
            "value": 713
          },
          "key": "gmail.com",
          "doc_count": 25925
        }, {
          "1": {
            "value": 286
          },
          "key": "users.noreply.github.com",
          "doc_count": 6428
        }]
      }
    },
    "status": 200
  }]
}
  • OTHER QUERY:
{
  "index": "git_enrich",
  "ignore_unavailable": true,
  "preference": 1582107058298
} {
  "aggs": {
    "other-filter": {
      "aggs": {
        "1": {
          "cardinality": {
            "field": "author_uuid"
          }
        }
      },
      "filters": {
        "filters": {
          "": {
            "bool": {
              "must": [{
                "exists": {
                  "field": "author_domain"
                }
              }],
              "filter": [],
              "should": [],
              "must_not": [{
                "match_phrase": {
                  "author_domain": {
                    "query": "gmail.com"
                  }
                }
              }, {
                "match_phrase": {
                  "author_domain": {
                    "query": "users.noreply.github.com"
                  }
                }
              }]
            }
          }
        }
      }
    }
  },
  "size": 0,
  "_source": {
    "excludes": []
  },
  "stored_fields": ["*"],
  "script_fields": {},
  "docvalue_fields": [{
    "field": "author_date",
    "format": "date_time"
  }, {
    "field": "commit_date",
    "format": "date_time"
  }, {
    "field": "demography_max_date",
    "format": "date_time"
  }, {
    "field": "demography_min_date",
    "format": "date_time"
  }, {
    "field": "grimoire_creation_date",
    "format": "date_time"
  }, {
    "field": "metadata__enriched_on",
    "format": "date_time"
  }, {
    "field": "metadata__timestamp",
    "format": "date_time"
  }, {
    "field": "metadata__updated_on",
    "format": "date_time"
  }, {
    "field": "utc_author",
    "format": "date_time"
  }, {
    "field": "utc_commit",
    "format": "date_time"
  }],
  "query": {
    "bool": {
      "must": [{
        "range": {
          "grimoire_creation_date": {
            "format": "strict_date_optional_time",
            "gte": "2014-02-19T10:23:37.747Z",
            "lte": "2020-02-19T10:23:37.747Z"
          }
        }
      }],
      "filter": [{
        "match_all": {}
      }],
      "should": [],
      "must_not": []
    }
  },
  "timeout": "30000ms"
}
  • OTHER RESPONSE:
{
  "took": 29,
  "responses": [{
    "took": 28,
    "timed_out": false,
    "_shards": {
      "total": 1,
      "successful": 1,
      "skipped": 0,
      "failed": 0
    },
    "hits": {
      "total": 84681,
      "max_score": null,
      "hits": []
    },
    "aggregations": {
      "other-filter": {
        "buckets": {
          "": {
            "1": {
              "value": 723
            },
            "doc_count": 52327
          }
        }
      }
    },
    "status": 200
  }]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment