在Elasticsearch中,文档归属于一种类型(type),而这些类型存在于索引(index)中,类比传统关系型数据库:
Relational DB -> Databases -> Tables -> Rows -> Columns
Elasticsearch -> Indices -> Types -> Documents -> Fields
_index:相当于库(database)
_type:相当于表(table)
_id:记录的唯一标识(primary key)
_source:相当于记录(record)
1.遇到的坑(ElasticSearch版本5.1.3)
使用termsQuery查询中文,无返回结果
原因:elasticsearch 里默认的IK分词器是会将每一个中文都进行了分词的切割,所以你直接想查一整个词,或者一整句话是无返回结果的。
TermsQueryBuilder termsQuery = QueryBuilders.termsQuery("src.keyword", src);