Skip to content
This repository was archived by the owner on Aug 2, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
198 changes: 198 additions & 0 deletions worksheets/rollups/comparisons.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
###

#21, 14, 3, 11, 24, 1, 1, 41, 14, 13
#POST localhost:9200/nyc-taxi-data/_search
POST localhost:9200/rollup-test-index/_search
Content-Type: application/json

{
"size": 0,
"aggs": {
"pickup_areas": {
"terms": { "field": "PULocationID", "size": 10, "order": { "_key": "asc" } },
"aggs": {
"sum": { "sum": { "field": "passenger_count" } }
}
}
}
}


###
POST localhost:9200/rollup-test-index/_search
#POST localhost:9200/nyc-taxi-data/_search
Content-Type: application/json

{
"size": 0,
"aggs": {
"pickup_areas": {
"terms": { "field": "PULocationID", "size": 1000, "order": { "_key": "asc" } },
"aggs": {
"sum": { "sum": { "field": "passenger_count" } },
"min": { "min": { "field": "passenger_count" } },
"max": { "max": { "field": "passenger_count" } },
"avg": { "avg": { "field": "passenger_count" } },
"value_count": { "value_count": { "field": "passenger_count" } }
}
}
}
}

###
POST localhost:9200/kibana_sample_data_ecommerce/_search
Content-Type: application/json

{
"size": 0,
"aggs": {
"city": {
"terms": {
"field": "geoip.city_name",
"size": 5,
"order": {"total_sales": "desc"}
},
"aggs": {
"total_sales": {
"sum": {
"field": "taxless_total_price"
}
}
}
}
}
}

###
POST localhost:9200/rollup-test-index/_search
Content-Type: application/json

{
"size": 0,
"aggs": {
"city": {
"terms": {
"field": "geoip.city_name",
"size": 5,
"order": {"total_sales": "desc"}
},
"aggs": {
"total_sales": {
"sum": {
"field": "taxless_total_price"
}
}
}
}
}
}
###
DELETE localhost:9200/rollup-test-index
###
PUT localhost:9200/rollup-test-index
Content-Type: application/json

{
"mappings": {
"_meta" : {
"schema_version": 1,
"rollups": {
"something": {}
}
},
"dynamic_templates" : [
{
"strings" : {
"match_mapping_type" : "string",
"mapping" : {
"type" : "keyword"
}
}
},
{
"date_histograms" : {
"path_match" : "*.date_histogram.*",
"mapping" : {
"type" : "date"
}
}
}
]
},
"settings": {
"index.opendistro.rollup_index": true
}
}
###
POST localhost:9200/kibana_sample_data_ecommerce/_search
Content-Type: application/json

{
"size": 0,
"aggs": {
"city": {
"terms": {
"field": "geoip.city_name",
"size": 5,
"order": {"avg_sale_price": "desc"}
},
"aggs": {
"avg_sale_price": {
"avg": {
"field": "taxless_total_price"
}
}
}
}
}
}

###
POST localhost:9200/rollup-test-index/_search
Content-Type: application/json

{
"size": 0,
"aggs": {
"city": {
"terms": {
"field": "geoip.city_name",
"size": 5,
"order": {"avg_sale_price": "desc"}
},
"aggs": {
"avg_sale_price": {
"avg": {
"field": "taxless_total_price"
}
}
}
}
}
}
###

POST localhost:9200/rollup-test-index/_search?pretty
Content-Type: application/json

{
"size": 10,
"sort": { "rollup.doc_count": "desc" },
"query": {
"exists": {
"field": "taxless_total_price.sum"
}
}
}
###
POST localhost:9200/kibana_*/_search?pretty
Content-Type: application/json

{
"size": 0,
"query": {
"match_all": {}
},
"aggs": {"RollupCompositeAggs":{"composite":{"size":10,"sources":[{"order_date":{"date_histogram":{"field":"order_date","missing_bucket":false,"value_type":"date","order":"asc","fixed_interval":"1h","time_zone":"America/Los_Angeles"}}},{"geoip.city_name":{"terms":{"field":"geoip.city_name","missing_bucket":false,"order":"asc"}}},{"customer_id":{"terms":{"field":"customer_id","missing_bucket":false,"order":"asc"}}},{"day_of_week":{"terms":{"field":"day_of_week","missing_bucket":false,"order":"asc"}}}]},"aggregations":{"taxless_total_price.avg":{"avg":{"field":"taxless_total_price"}},"taxless_total_price.sum":{"sum":{"field":"taxless_total_price"}},"taxless_total_price.max":{"max":{"field":"taxless_total_price"}},"taxless_total_price.min":{"min":{"field":"taxless_total_price"}},"taxless_total_price.value_count":{"value_count":{"field":"taxless_total_price"}}}}}
}
###
160 changes: 160 additions & 0 deletions worksheets/rollups/create.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@

PUT localhost:9200/_opendistro/_rollup/jobs/example
Content-Type: application/json

{
"rollup": {
"enabled": true,
"schedule": {
"interval": {
"period": 1,
"unit": "Minutes",
"start_time": {{$timestamp}}
}
},
"last_updated_time": {{$timestamp}},
"description": "An example rollup",
"source_index": "nyc-taxi-data",
"target_index": "rollup-test-index",
"page_size": 10,
"delay": 0,
"continuous": false,
"dimensions": [{
"date_histogram": {
"source_field": "timestamp",
"fixed_interval": "1h"
}
}, {
"terms": { "source_field": "RatecodeID" }
}, {
"terms": { "source_field": "PULocationID" }
}],
"metrics": [{
"source_field": "passenger_count",
"metrics": [{ "avg": {} },{ "sum": {} }, { "max": {} }, { "min": {} }, { "value_count": {} }]
}, {
"source_field": "total_amount",
"metrics": [{ "avg": {} },{ "sum": {} }, { "max": {} }, { "min": {} }, { "value_count": {} }]
}]
}
}
###
PUT localhost:9200/_opendistro/_rollup/jobs/example
Content-Type: application/json

{
"rollup": {
"enabled": true,
"schedule": {
"interval": {
"period": 1,
"unit": "Minutes",
"start_time": {{$timestamp}}
}
},
"last_updated_time": {{$timestamp}},
"description": "An example rollup",
"source_index": "test-index",
"target_index": "rollup-test-index",
"page_size": 100,
"delay": 0,
"dimensions": [{
"date_histogram": {
"field": "@timestamp",
"fixed_interval": "1h",
"timezone": "1h"
}
}]
}
}

###
DELETE localhost:9200/_opendistro/_rollup/jobs/example
Content-Type: application/json

###
GET localhost:9200/_opendistro/_rollup/jobs/example
Content-Type: application/json

###
DELETE localhost:9200/rollup-test-index

###
GET localhost:9200/rollup-test-index/_mappings

###
POST localhost:9200/rollup-test-index/_search

###
POST localhost:9200/rollup-test-index/_doc
Content-Type: application/json

{
"hey": 1,
"updated_at": 1600381015
}

###
POST localhost:9200/test/_doc
Content-Type: application/json

{
"hey": 5,
"updated_at": 1600381015
}

###
POST localhost:9200/*/_search

###
PUT localhost:9200/ok

###
POST localhost:9200/ok/_doc
Content-Type: application/json

{
"ok": 5
}

###
GET localhost:9200/ok,two/_search
Content-Type: application/json

{
"query": {
"term": {
"some_random_field": {
"value": "nothing"
}
}
}
}

###
PUT localhost:9200/_opendistro/_rollup/jobs/example/_start

###
PUT localhost:9200/_opendistro/_rollup/jobs/example/_stop

###
GET localhost:9200/.opendistro-ism-config/_search?pretty

###
PUT localhost:9200/ok
###
PUT localhost:9200/two-02
###
GET localhost:9200/ok,two*,t*,*/_search


###

GET localhost:9200/rollup-test-index/_mapping/field/_meta?include_defaults=true

###

GET localhost:9200/rollup-test-index/_mapping


###
10 changes: 10 additions & 0 deletions worksheets/rollups/kibana_sample_data.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This will ingest the kibana sample ecommerce data into the cluster iff kibana
# is running on 5601. If using local dev kibana make sure to pass yarn start --no-base-path
POST localhost:5601/api/sample_data/ecommerce
Connection: keep-alive
kbn-version: 7.9.1
Accept: */*
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36
Content-Type: application/json
###

Loading