facet【聚類】,在elacticsearch搜尋結果的基礎上,對某個字段按照內容的不同進行分類統計。
package bio_rdf.impl.fieldfacet;
import org.elasticsearch.action.search.searchrequestbuilder;
import org.elasticsearch.action.search.searchresponse;
import org.elasticsearch.action.search.searchtype;
import org.elasticsearch.client.client;
import org.elasticsearch.client.transport.transportclient;
import org.elasticsearch.common.settings.immutablesettings;
import org.elasticsearch.common.settings.settings;
import org.elasticsearch.common.transport.inetsockettransportaddress;
import org.elasticsearch.index.query.querybuilder;
import org.elasticsearch.index.query.querybuilders;
import org.elasticsearch.index.query.querystringquerybuilder;
import org.elasticsearch.search.facet.facetbuilders;
import org.elasticsearch.search.facet.terms.termsfacet;
//public class esfieldfacet
client.close();
}}
result:
--------------start------------------
fusobacterium nucleatum subsp. vincentii atcc 49256
302---------------end-----------------
以上結果出現的前提是:organism欄位在錄入索引的時候,elasticsearch不對其進行解析。
相反,當elasticsearch對organism進行解析的時候,結果就是下面的內容【因為當es對欄位進行解析的時候,首先呼叫standard解析器,先把字段按照一定格式分隔,然後再將大寫字母變為小寫,變成了「一袋子」單詞】
--------------start------------------
vincentii
302---------------end-----------------
--------------start------------------
subsp
302---------------end-----------------
--------------start------------------
nucleatum
302---------------end-----------------
--------------start------------------
fusobacterium
302---------------end-----------------
--------------start------------------
atcc49256
302---------------end-----------------
LineDDA的乙個例子
unit unit1 inte ce uses windows,messages,sysutils,variants,classes,graphics,controls,forms,dialogs,extctrls,stdctrls,buttons type tfmmain class tform ...
SQL GROUP CONCAT的乙個例子
我有乙個這樣的資料庫 user info 現在有乙個需求是把這樣 9 條記錄按照 username 來 group 成3條記錄 目標 shu female 201 lee male 202 yuki female 181 如果用select from user info group by usern...
explode的乙個例子
select level as level,explode split 1,2,3 as value 可以生成結果 level value level 1 level 2 level 3 lateral view 1.lateral view 用於和udtf函式 explode,split 結合來使...