Skip to content

Instantly share code, notes, and snippets.

@lloydw
Created May 26, 2016 22:27
Show Gist options
  • Save lloydw/865bbcc0508288576648bff17c871234 to your computer and use it in GitHub Desktop.
Save lloydw/865bbcc0508288576648bff17c871234 to your computer and use it in GitHub Desktop.
ElasticSearch sample outputs
import json
data1 = json.loads("""{
"took": 19,
"timed_out": false,
"_shards": {
"total": 40,
"successful": 40,
"failed": 0
},
"hits": {
"total": 30701,
"max_score": 0.0,
"hits": []
},
"aggregations": {
"group_by_date": {
"buckets": [{
"key_as_string": "2016-03-10T00:00:00.000Z",
"key": 1457568000000,
"doc_count": 6300,
"group_by_action": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": []
}
}, {
"key_as_string": "2016-03-11T00:00:00.000Z",
"key": 1457654400000,
"doc_count": 3231,
"group_by_action": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": []
}
}, {
"key_as_string": "2016-03-12T00:00:00.000Z",
"key": 1457740800000,
"doc_count": 565,
"group_by_action": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": []
}
}, {
"key_as_string": "2016-03-13T00:00:00.000Z",
"key": 1457827200000,
"doc_count": 1065,
"group_by_action": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": []
}
}, {
"key_as_string": "2016-03-14T00:00:00.000Z",
"key": 1457913600000,
"doc_count": 4921,
"group_by_action": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": []
}
}, {
"key_as_string": "2016-03-15T00:00:00.000Z",
"key": 1458000000000,
"doc_count": 4644,
"group_by_action": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": []
}
}, {
"key_as_string": "2016-03-16T00:00:00.000Z",
"key": 1458086400000,
"doc_count": 9753,
"group_by_action": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [{
"key": "open",
"doc_count": 12
}, {
"key": "click",
"doc_count": 3
}]
}
}, {
"key_as_string": "2016-03-17T00:00:00.000Z",
"key": 1458172800000,
"doc_count": 222,
"group_by_action": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": []
}
}]
}
}
}""")
data2 = json.loads("""
{
"took": 1250,
"timed_out": false,
"_shards": {
"total": 700,
"successful": 700,
"failed": 0
},
"hits": {
"total": 28066,
"max_score": 0.0,
"hits": []
},
"aggregations": {
"group_by_date": {
"buckets": [{
"key_as_string": "2016-01-09T00:00:00.000Z",
"key": 1452297600000,
"doc_count": 289,
"user_count": {
"value": 84
}
}, {
"key_as_string": "2016-01-10T00:00:00.000Z",
"key": 1452384000000,
"doc_count": 363,
"user_count": {
"value": 81
}
}, {
"key_as_string": "2016-01-11T00:00:00.000Z",
"key": 1452470400000,
"doc_count": 426,
"user_count": {
"value": 93
}
}, {
"key_as_string": "2016-01-12T00:00:00.000Z",
"key": 1452556800000,
"doc_count": 469,
"user_count": {
"value": 105
}
}, {
"key_as_string": "2016-01-13T00:00:00.000Z",
"key": 1452643200000,
"doc_count": 417,
"user_count": {
"value": 90
}
}]
}
}
}
""")
data3 = json.loads("""
{
"took": 20,
"timed_out": false,
"_shards": {
"total": 40,
"successful": 40,
"failed": 0
},
"hits": {
"total": 49,
"max_score": 0.0,
"hits": []
},
"aggregations": {
"group_by_batch": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [{
"key": "2016-13",
"doc_count": 12,
"opens": {
"doc_count": 5,
"unique_open_count": {
"value": 1
}
}
}]
}
}
}
""")
data4 = json.loads("""
{
"took": 107,
"timed_out": false,
"_shards": {
"total": 750,
"successful": 750,
"failed": 0
},
"hits": {
"total": 168,
"max_score": 0.0,
"hits": []
},
"aggregations": {
"group_by_date": {
"buckets": [{
"key_as_string": "2016-03-23T00:00:00.000Z",
"key": 1458691200000,
"doc_count": 15,
"filteredAggs": {
"buckets": {
"invitesLoaded": {
"doc_count": 2
},
"detectOSLoaded": {
"doc_count": 1
}
}
}
}, {
"key_as_string": "2016-03-24T00:00:00.000Z",
"key": 1458777600000,
"doc_count": 16,
"filteredAggs": {
"buckets": {
"invitesLoaded": {
"doc_count": 2
},
"detectOSLoaded": {
"doc_count": 3
}
}
}
}, {
"key_as_string": "2016-03-25T00:00:00.000Z",
"key": 1458864000000,
"doc_count": 52,
"filteredAggs": {
"buckets": {
"invitesLoaded": {
"doc_count": 9
},
"detectOSLoaded": {
"doc_count": 5
}
}
}
}, {
"key_as_string": "2016-03-26T00:00:00.000Z",
"key": 1458950400000,
"doc_count": 28,
"filteredAggs": {
"buckets": {
"invitesLoaded": {
"doc_count": 3
},
"detectOSLoaded": {
"doc_count": 4
}
}
}
}, {
"key_as_string": "2016-03-27T00:00:00.000Z",
"key": 1459036800000,
"doc_count": 21,
"filteredAggs": {
"buckets": {
"invitesLoaded": {
"doc_count": 3
},
"detectOSLoaded": {
"doc_count": 3
}
}
}
}, {
"key_as_string": "2016-03-28T00:00:00.000Z",
"key": 1459123200000,
"doc_count": 34,
"filteredAggs": {
"buckets": {
"invitesLoaded": {
"doc_count": 5
},
"detectOSLoaded": {
"doc_count": 5
}
}
}
}, {
"key_as_string": "2016-03-29T00:00:00.000Z",
"key": 1459209600000,
"doc_count": 2,
"filteredAggs": {
"buckets": {
"invitesLoaded": {
"doc_count": 2
},
"detectOSLoaded": {
"doc_count": 0
}
}
}
}]
}
}
}
""")
data5 = json.loads("""
{
"took": 165,
"timed_out": false,
"_shards": {
"total": 755,
"successful": 755,
"failed": 0
},
"hits": {
"total": 4020,
"max_score": 0.0,
"hits": []
},
"aggregations": {
"filteredAggs": {
"buckets": {
"click-count": {
"doc_count": 10
},
"open-count": {
"doc_count": 28
},
"respond-count": {
"doc_count": 4
}
}
}
}
}
""")
data6 = json.loads("""
{
"took": 75,
"timed_out": false,
"_shards": {
"total": 755,
"successful": 755,
"failed": 0
},
"hits": {
"total": 622,
"max_score": 0.0,
"hits": []
},
"aggregations": {
"group_by_batch": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [{
"key": "2016-13",
"doc_count": 400,
"clicks-content": {
"doc_count": 20
},
"filteredAggs": {
"buckets": {
"emails-sent": {
"doc_count": 10
},
"emails-sent-to-admin": {
"doc_count": 1
},
"emails-sent-to-user": {
"doc_count": 8
}
}
},
"opens": {
"doc_count": 189,
"unique-opens": {
"value": 10
}
},
"clicks-join": {
"doc_count": 8,
"unique-clicks-join": {
"value": 1
}
}
}, {
"key": "2016-14",
"doc_count": 222,
"clicks-content": {
"doc_count": 19
},
"filteredAggs": {
"buckets": {
"emails-sent": {
"doc_count": 10
},
"emails-sent-to-admin": {
"doc_count": 5
},
"emails-sent-to-user": {
"doc_count": 5
}
}
},
"opens": {
"doc_count": 52,
"unique-opens": {
"value": 35
}
},
"clicks-join": {
"doc_count": 0,
"unique-clicks-join": {
"value": 0
}
}
}]
}
}
}
""")
@babyboyJohntitian25
Copy link

hey

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