2019年6月26日 星期三

kate progarm practice

1. kate
http://www.shute.kh.edu.tw/~92d314/email/2decision-tree.htm
https://www.slideshare.net/teddysoft/bowling-game-kata-132735820
http://codingdojo.org/kata/


2.  ACM
https://www.cs.ubc.ca/~acm-web/practice/
http://codeforces.com/
https://www.codechef.com/


3. practice
https://codeforces.com/group/L0zlhp0AHw/contest/1155/problem/A


4. reference
https://www.quora.com/How-should-I-practice-for-ACM-ICPC

2019年6月17日 星期一

ES

Reference

ch: 1 2 3

1. DSL

DSL (domain-specific language),領域特定語言指的是專注於某個應用程式領域的計算機語言,

1. Simple  dsl

{
  "query": {
    "match": {
      "status": {
        "query": 200,
        "type": "phrase"
      }
    }
  }
}

2.
{
  "query": {
    "match": {
      "remote_addr": {
        "query": "110.28.1.9",
        "type": "phrase"
      }
    }
  }
}


3.BOOLEAN example ref 1


   
{
   "bool" : {
      "must" :     [],
      "should" :   [],
      "must_not" : [],
   }
}
GET
/my_store/products/_search { "query" : { "filtered" : { "filter" : { "bool" : { "should" : [ { "term" : {"price" : 20}}, { "term" : {"productID" : "XHDK-A-1293-#fJ3"}} ], "must_not" : { "term" : {"price" : 30} } } } } } }



GET _search
{
    "query": {
    "bool": {
      "must": [
        {
          "range": {
            "@timestamp": {
              "gte": 1560807190000,
              "lte": 1560828790000,
              "format": "epoch_millis"
            }
          }
        },
        {
          "query_string": {
            "query": "*",
            "analyze_wildcard": true
          }
        },
        {
          "match": {
            "upstream_addr": {
              "type": "phrase",
              "query": "202.39.43.17:80"
            }
          }
        }
      ]
    }
  }
}


4. AGGS

GET /cars/transactions/_search
{
    "size" : 0,
    "aggs" : { 
        "popular_colors" : { 
            "terms" : { 
              "field" : "color"
            }
        }
    }
}
能会注意到我们将 size 设置成 0 。我们并不关心搜索结果的具体内容,所以将返回记录数设置为 0 来提高查询速度。 设置 size: 0 与 Elasticsearch 1.x 中使用 count 搜索类型等价。


2. VIsualize

https://www.elastic.co/guide/cn/kibana/current/tutorial-visualizing.html