ES 查詢語句
1.查詢總數,ES最大查詢傳回10000條,kibana查詢時添加 ?rest_total_hits_as_int
GET test/_search?rest_total_hits_as_int
{
"query": {
"match_all": {}
}
2.根據某一項的聚合:ElasticSearch Terms Aggregation
聚合查詢報錯:Fielddata is disabled on text fields by default. Set fielddata=true on [title] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead.
3.清空索引下所有資料
POST test/_delete_by_query
4. ES重複項目删除
POST ys_related_sv/_delete_by_query
"bool" : {
"must_not": [
"exists": {"field": "vid"}
]
注意:需要删除索引重建才能設定!!!
開啟Text的fielddata=true, 在ES中預設fielddata是false,因為開啟text的,注意:這樣會取消es的反向索引功能,并且很吃記憶體
5.es查詢不存在的字段
GET ys_related_sv/_search
"must": [