elastic search查詢命令集合

Technorati 標籤: elastic search, query, commands

基本查詢:最簡單的查詢方式 this

query:{「term」:{「title」:「crime」}} 排序

terms:目標列包含指定詞 索引

match:會把輸入的「短語」進行分解成詞 ip

bool match:match分解成多個詞,而且是and的關係,默認是or的關係 ci

match phrase:分詞,可是要指定分詞之間詞語的個數 get

match phrase prefix: string

multi match:做用於多個字段的match查詢 it

query string:支持lucence查詢語法,title:crime^10+title:punishment-otitle:cat,用+-表示include和exclude,用^表示權重 table

field查詢:是queyr查詢的簡化版本 ast

ids查詢:field查詢的特殊狀況,只針對id

prefix查詢:相似於term查詢,可是不是所有匹配

fuzzy like this查詢:查詢類似的文本,怎麼計算類似度呢?

fuzzy like this field查詢:選定title

fuzzy查詢:模糊查詢,根據詞語之間的編輯距離獲得

wildcard查詢:使用* ?的term查詢

more like this:like且設定好範圍

range:數字範圍查詢,from to

查詢重寫???

------------------------------------------------

過濾查詢 ,對查詢結果進行過濾

filter:term{「year」:1981},過濾結果中year爲1981的數據

filter:range :過濾結果中指定列在指定範圍的數據

filter:exists :結果中存在某列的數據

filter:missing :結果中缺失某列的數據

filter:scripts:bool表達式 :結果中知足腳本指定條件的數據

filter:type :類型過濾

filter:limit :限定必定數量的結果

filter:ids :限定特殊的id集合

filter:not,and,or :多個條件的組合

-----------------------------------

組合查詢 :多個條件的組合查詢

bool:{「must」:{查詢1},「should」:{查詢2}}

boosting:將多個查詢封裝起來,positive的分數增高,negative分數下降

costant score:恆定分數

indices:在多個索引上查詢

custom filters score:

-------------------------

對查詢結果進行排序

「sort」:{「a」:「desc」}

相關文章
相關標籤/搜索