2017-07-14 8 views
0

機能パス別にアクセスを集計したい。ElasticSearch - 集計アクセスログはどのようにGETパラメータを無視しますか?

{ 
    "query": { 
    "bool": { 
     "must": [ 
     { 
      "wildcard": { 
      "path.keyword": "/hex/*" 
      } 
     } 
     ] 
    } 
    }, 
    "from": 0, 
    "size": 0, 
    "aggs": { 
    "path": { 
     "terms": { 
     "field": "path.keyword" 
     } 
    } 
    } 
} 

は、私は。これらのような結果を得る

{ 
    "key": "/hex/user/admin_user/auth", 
    "doc_count": 38 
}, 
{ 
    "key": "/hex/report/chart/fastreport_lobby_all?start_date=2017-06-29&end_date=2017-07-05&category=date_range&value[]=payoff", 
    "doc_count": 35 
}, 
{ 
    "key": "/hex/report/chart/fastreport_lobby_all?start_date=2017-06-29&end_date=2017-07-05&category=lobby&value[]=payoff", 
    "doc_count": 35 
}, 
{ 
    "key": "/hex/report/chart/online_membership?start_date=2017-06-29&end_date=2017-07-05&category=datetime_range&value[]=user_total", 
    "doc_count": 34 
} 

2 /ヘキサン/レポート/チャート/ fastreport_lobby_all?balabala ...結果があります。

この機能についての実際のカウントではありません。

私はこれらを1つとして数える方法はありますか?

{ 
    "key": "/hex/report/chart/fastreport_lobby_all", 
    "doc_count": 70 
} 

答えて

1

私は

PUT your_index 
{ 
    "settings": { 
     "analysis": { 
     "analyzer": { 
      "query_analyzer": { 
       "type": "custom", 
       "tokenizer": "split_query", 
       "filter": ["top1" 
       ] 
      } 
     }, 
     "filter":{ 
      "top1":{ 
        "type": "limit", 
        "max_token_count": 1 
        } 
     }, 
     "tokenizer":{ 
      "split_query":{ 
        "type": "pattern", 
        "pattern": "\\?" 
       } 
     } 
     } 
    }, 
    "mappings": { 
     "your_log_type": { 
     "properties": { 
      "path": { 
       "type": "text", 
       "fields": { 
        "keyword": { 
         "type":"keyword" 
        }, 
        "no_query": { 
         "type":"string", 
         "fielddata":true, 
         "analyzer":"query_analyzer" 
        } 
       } 
      } 
     } 
     } 
    } 
} 

のようなカスタム・アナライザなしでこれが可能だと思います。そして

POST test/log_type/_search 
{ 
    "query": { 
    "bool": { 
     "must": [ 
     { 
      "wildcard": { 
      "path.keyword": "/hex/*" 
      } 
     } 
     ] 
    } 
    }, 
    "from": 0, 
    "size": 0, 
    "aggs" : { 
     "genres" : { 
      "terms" : { "field" : "path.no_query" } 
     } 
    } 
} 
に照会しません。
関連する問題