그냥 사는 이야기

Kibana - Search, Aggregation 본문

Development/기타

Kibana - Search, Aggregation

없다캐라 2020. 1. 25. 03:28
반응형

Kibana

Data 준비

curl -X DELETE localhost:9200/basketball
{"acknowledged":true}

curl -X PUT localhost:9200/basketball
{"acknowledged":true,"shards_acknowledged":true,"index":"basketball"}rudalson@C02WR164G8WL:~/Applications:>

curl -X PUT 'localhost:9200/basketball/record/_mappin' -H 'Content-Type: application/json' -d @basketball_mapping.json
{"_index":"basketball","_type":"record","_id":"_mappin","_version":1,"result":"created","_shards":{"total":2,"successful":1,"failed":0},"_seq_no":0,"_primary_term":1}

curl -X POST 'localhost:9200/_bulk?pretty' -H 'Content-Type: application/json' --data-binary @bulk_basketball.json
basketball_mapping.json
{
    "record" : {
        "properties" : {
            "team" : {
                    "type" : "text",
                    "fielddata" : true
            },
            "name" : {
                    "type" : "text",
                    "fielddata" : true
            },
            "points" : {
                    "type" : "long"
            },
            "rebounds" : {
                    "type" : "long"
            },
            "assists" : {
                    "type" : "long"
            },
            "blocks" : {
                    "type" : "long"
            },
            "submit_date" : {
                    "type" : "date",
                    "format" : "yyyy-MM-dd"
            }
        }
    }
}
bulk_basketball.json
{ "index" : { "_index" : "basketball", "_type" : "record", "_id" : "1" } }
{"team" : "Golden States Warriors","name" : "Stephen Curry", "points" : 30,"rebounds" : 3,"assists" : 4, "blocks" : 5, "submit_date" : "2016-10-11"}
{ "index" : { "_index" : "basketball", "_type" : "record", "_id" : "2" } }
{"team" : "Golden States Warriors","name" : "Stephen Curry","points" : 32,"rebound" : 5,"assist" : 8, "blocks" : 5, "submit_date" : "2016-10-13"}
{ "index" : { "_index" : "basketball", "_type" : "record", "_id" : "3" } }
{"team" : "Golden States Warriors","name" : "Stephen Curry","points" : 28,"rebound" : 2,"assist" : 3, "blocks" : 1, "submit_date" : "2016-10-17"}
{ "index" : { "_index" : "basketball", "_type" : "record", "_id" : "4" } }
{"team" : "Golden States Warriors","name" : "Stephen Curry","points" : 36,"rebound" : 1,"assist" : 2, "blocks" : 1, "submit_date" : "2016-11-20"}
{ "index" : { "_index" : "basketball", "_type" : "record", "_id" : "5" } }
{"team" : "Golden States Warriors","name" : "Stephen Curry","points" : 36,"rebound" : 1,"assist" : 2, "blocks" : 1, "submit_date" : "2016-11-25"}
{ "index" : { "_index" : "basketball", "_type" : "record", "_id" : "6" } }
{"team" : "Golden States Warriors","name" : "Stephen Curry","points" : 32,"rebound" : 1,"assist" : 4, "blocks" : 1, "submit_date" : "2016-11-28"}
{ "index" : { "_index" : "basketball", "_type" : "record", "_id" : "7" } }
{"team" : "Utah Jazz","name" : "Rudy Gobert", "points" : 3,"rebounds" : 11,"assists" : 4, "blocks" : 7, "submit_date" : "2016-10-12"}
{ "index" : { "_index" : "basketball", "_type" : "record", "_id" : "8" } }
{"team" : "Utah Jazz","name" : "Rudy Gobert","points" : 4,"rebound" : 13,"assist" : 8, "blocks" : 5, "submit_date" : "2016-10-14"}
{ "index" : { "_index" : "basketball", "_type" : "record", "_id" : "9" } }
{"team" : "Utah Jazz","name" : "Rudy Gobert","points" : 8,"rebound" : 10,"assist" : 3, "blocks" : 6, "submit_date" : "2016-10-18"}
{ "index" : { "_index" : "basketball", "_type" : "record", "_id" : "10" } }
{"team" : "Utah Jazz","name" : "Rudy Gobert","points" : 12,"rebound" : 9,"assist" : 2, "blocks" : 6, "submit_date" : "2016-11-10"}
{ "index" : { "_index" : "basketball", "_type" : "record", "_id" : "11" } }
{"team" : "Utah Jazz","name" : "Rudy Gobert","points" : 12,"rebound" : 14,"assist" : 2, "blocks" : 7, "submit_date" : "2016-11-22"}
{ "index" : { "_index" : "basketball", "_type" : "record", "_id" : "12" } }
{"team" : "Utah Jazz","name" : "Rudy Gobert","points" : 8,"rebound" : 10,"assist" : 4, "blocks" : 5, "submit_date" : "2016-11-27"}
{ "index" : { "_index" : "basketball", "_type" : "record", "_id" : "13" } }
{"team" : "Washington Wizards","name" : "John Wall","points" : 8,"rebound" : 1,"assist" : 13, "blocks" : 2, "submit_date" : "2016-10-18"}
{ "index" : { "_index" : "basketball", "_type" : "record", "_id" : "14" } }
{"team" : "Washington Wizards","name" : "John Wall","points" : 13,"rebound" : 2,"assist" : 12, "blocks" : 3, "submit_date" : "2016-11-10"}
{ "index" : { "_index" : "basketball", "_type" : "record", "_id" : "15" } }
{"team" : "Washington Wizards","name" : "John Wall","points" : 15,"rebound" : 3,"assist" : 12, "blocks" : 3, "submit_date" : "2016-11-22"}
{ "index" : { "_index" : "basketball", "_type" : "record", "_id" : "16" } }
{"team" : "Washington Wizards","name" : "John Wall","points" : 22,"rebound" : 4,"assist" : 14, "blocks" : 3, "submit_date" : "2016-11-27"}
Comments