Elasticsearch筆記 原

源數據:postcode = "wbadfkjasdlfjakdslfjasdlfjds"

_前綴搜索(不適合大量數據搜索): GET /test/test/_search  
{  
    "query":{  
        "prefix":{  
            "postcode": "wb" //wb開頭  
        }  
    }  
}  

模糊搜索(? 匹配任意字符, \* 匹配 0 或多個字符 不適合大量數據搜索):  
GET test/test/_search 

    "query":
    {
        "wildcard":{ "postcode": "w?_a*dfsf"}  
    }  
}  
正則搜索(不適合大量數據搜索):  
GET test/test/_search  
{  
    "query":{  
        "regexp":{  
            "postcode": "W\[0-9\].+" //以 W 開頭,緊跟 0 至 9 之間的任何一個數字,然後接一或多個其他字符  
        }  
    }  
}

查看索引:
GET /*/_alias/別名?pretty 
curl -XGET "http://127.0.0.1:9200/*/_alias/test_post_list5?pretty" //查看別名對應的索引
返回值:
{
  "test_post_list5_32" : {
    "aliases" : {
      "test_post_list5" : { }
    }
  }
}
GET /test_post_list5_32/_alias/*?pretty
curl -XGET "http://127.0.0.1:9200/test_post_list5_32/_alias/*?pretty" //查看索引對應的別名

返回值:
  "test_post_list5_32" : {
    "aliases" : {
      "test_post_list5" : { },
      "test_post_list5_test" : { }
    }
  }
}

查看索引文檔總數:
GET /_cat/count/test_post_list33?v"

返回值:
epoch      timestamp count
1541844015 18:00:15  1977

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章