Skip to content

Instantly share code, notes, and snippets.

View marcellustavares's full-sized avatar

Marcellus Tavares marcellustavares

View GitHub Profile
@marcellustavares
marcellustavares / script_response.json
Created August 24, 2018 12:52
Script Aggregation Response
{
"total": 6,
"queryTime": 4,
"_aggregations": {
"cities": {
"buckets": [
{
"aggregations": {
"avg_fahrenheit": 62.666666666666664,
"avg_celsius": 17.037037037037035
@marcellustavares
marcellustavares / script_sample.json
Created August 24, 2018 12:51
WeDeploy Script Aggregation
[
{
"city": "Los Angeles",
"temp": 50
},
{
"city": "Los Angeles",
"temp": 45
},
{
@marcellustavares
marcellustavares / Nested Response Sample (Terms-Sum)
Created August 23, 2018 18:42
WeDeploy Nested Sample Response
{
"total": 46,
"queryTime": 7,
"_aggregations": {
"pages": {
"buckets": [
{
"aggregations": {
"views": 18
},
@marcellustavares
marcellustavares / nested_sample.json
Created August 23, 2018 18:39
WeDeploy Nested Sample
[
{"primary_key":-405357180,"analytics_key":"customer.liferay.com","touchpoint":"https://customer.liferay.com/documentation/7.0/reference/-/official_documentation/reference/elasticsearch-settings","event_date":"2018-05-07T04:00","user_id":"0361d8e0-72a3-11e8-944b-41a597564fee","country":"Australia","region":"New South Wales","city":"Mascot","browser_name":"Safari","device_type":"Desktop","platform_name":"macOS","engagement":0.27,"time_on_page":10000,"views":1,"bounces":0},
{"primary_key":-41466125,"analytics_key":"www.liferay.com","touchpoint":"https://www.liferay.com/","event_date":"2018-06-13T22:00","user_id":"AWDs48iERQhVcGP_61oT","country":"United States","region":"California","city":"Montclair","browser_name":"Chrome","device_type":"Desktop","platform_name":"macOS","engagement":0.27,"time_on_page":3000,"views":1,"bounces":1},
{"primary_key":-1988533760,"analytics_key":"www.liferay.com","touchpoint":"https://www.liferay.com/","event_date":"2018-06-23T01:00","user_id":"2174c680-7681-11e8-983c-0
@marcellustavares
marcellustavares / cardinality_sample.json
Created August 23, 2018 17:22
WeDeploy Cardinality Sample Data
[
{
"identifier": 1,
"email": "iliyan.peychev@liferay.com",
"event": "pageView",
"url": "http://www.liferay.com"
},
{
"identifier": 2,
"email": "iliyan.peychev@liferay.com",
@marcellustavares
marcellustavares / multi_match_sample.json
Created August 23, 2018 14:25
WeDeploy MultiMatch Sample Data
[
{
"identifier": 1,
"first_name": "Etta",
"last_name": "James"
},
{
"identifier": 2,
"first_name": "James",
"last_name": "Stewart"
#!/usr/bin/python
import os
from os import walk
from cassandra.cluster import Cluster
from cassandra.query import BatchStatement
from cassandra.query import SimpleStatement
def list_all_data_file_paths():
data_file_paths = []
@marcellustavares
marcellustavares / touchpoints.json
Created May 30, 2018 14:05
sample touchpoints with engagement gt than 1
{
"took": 3,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
},
"hits": {
@marcellustavares
marcellustavares / cassandra_importer.py
Created February 27, 2018 17:22
Cassandra Data Importer
#!/usr/bin/python
import os
from os import walk
from cassandra.cluster import Cluster
def list_all_data_file_paths():
data_file_paths = []
for (dirpath, dirnames, filenames) in walk('data'):
CREATE TABLE form_metrics (
analyticsKey VARCHAR,
formId BIGINT,
year int,
month int,
day int,
views BIGINT,
submissions BIGINT,
PRIMARY KEY(analyticsKey, formId, year, month, day)
)