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”}

相关文章
相关标签/搜索