Skip to content

Instantly share code, notes, and snippets.

@metacpan-user
Last active November 18, 2016 01:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save metacpan-user/5521726 to your computer and use it in GitHub Desktop.
Save metacpan-user/5521726 to your computer and use it in GitHub Desktop.
Aggregate by License
{
"query": {
"range": {
"date": {
"gt": "2010-06-05T00:00:00",
"lt": "2011-06-05T00:00:00"
}
}
},
"aggs": {
"license": {
"terms": {
"field": "license",
"size": 10
}
}
},
"size": 0
}
{
"timed_out" : false,
"hits" : {
"hits" : [],
"max_score" : 1,
"total" : 22489
},
"_shards" : {
"failed" : 0,
"successful" : 5,
"total" : 5
},
"took" : 150,
"facets" : {
"license" : {
"other" : 106,
"terms" : [
{
"count" : 14886,
"term" : "perl_5"
},
{
"count" : 4705,
"term" : "unknown"
},
{
"count" : 1134,
"term" : "open_source"
},
{
"count" : 695,
"term" : "artistic_2"
},
{
"count" : 303,
"term" : "mit"
},
{
"count" : 230,
"term" : "artistic_1"
},
{
"count" : 197,
"term" : "bsd"
},
{
"count" : 94,
"term" : "apache_2_0"
},
{
"count" : 78,
"term" : "freebsd"
},
{
"count" : 61,
"term" : "unrestricted"
}
],
"missing" : 0,
"_type" : "terms",
"total" : 22489
}
}
}
@reyjrar
Copy link

reyjrar commented Nov 18, 2016

/cpan_v1/release/_search
{
  "query": {
    "range": {
      "date": {
        "gt": "2010-06-05T00:00:00",
        "lt": "2011-06-05T00:00:00"
      }
    }
  },
  "aggs": {
    "license": {
      "terms": {
        "field": "license",
        "size": 10
      }
    }
  },
  "size": 0
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment