Reference
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
沒有留言:
張貼留言