bool query

must

The clause (query) must appear in matching documents.

should

The clause (query) should appear in the matching document. In a boolean query with no must clauses, one or more should clauses must match a document. The minimum number of should clauses to match can be set using the minimum_should_matchparameter.

must_not

The clause (query) must not appear in the matching documents.

The bool query also supports disable_coord parameter (defaults to false). Basically the coord similarity computes a score factor based on the fraction of all query terms that a document contains. See Lucene BooleanQuery for >{
    "bool" : {
        "must" : {
            "term" : { "user" : "kimchy" }
        },
        "must_not" : {
            "range" : {
                "age" : { "from" : 10, "to" : 20 }
            }
        },
        "should" : [
            {
                "term" : { "tag" : "wow" }
            },
            {
                "term" : { "tag" : "elasticsearch" }
            }
        ],
        "minimum_should_match" : 1,
        "boost" : 1.0
    }
}

本文出自:
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html

minimum_should_match 使用效果:bool query 中的should条件会过滤,相当于bool filter中should;且只能紧跟bool query中的should后面使用,其它位置会报异常

ElasticSearch中如何让query should等同于filter should的更多相关文章

  1. 【转】elasticsearch的查询器query与过滤器filter的区别

    很多刚学elasticsearch的人对于查询方面很是苦恼,说实话es的查询语法真心不简单-  当然你如果入门之后,会发现elasticsearch的rest api设计是多么有意思. 说正题,ela ...

  2. ElasticSearch的 Query DSL 和 Filter DSL

    Elasticsearch支持很多查询方式,其中一种就是DSL,它是把请求写在JSON里面,然后进行相关的查询. Query DSL 与 Filter DSL DSL查询语言中存在两种:查询DSL(q ...

  3. Elasticsearch学习笔记(十二)filter与query

    一.keyword 字段和keyword数据类型    1.测试准备数据 POST /forum/article/_bulk { "index": { "_id" ...

  4. Elasticsearch(5) --- Query查询和Filter查询

    Elasticsearch(5) --- Query查询和Filter查询 这篇博客主要分为 :Query查询和Filter查询.有关复合查询.聚合查询也会单独写篇博客. 一.概念 1.概念 一个查询 ...

  5. Elasticsearch由浅入深(九)搜索引擎:query DSL、filter与query、query搜索实战

    search api的基本语法 语法概要: GET /_search {} GET /index1,index2/type1,type2/_search {} GET /_search { , } h ...

  6. elasticsearch中的filter与aggs

    今天在ES上做了一个聚合,先过滤一个嵌套对象,再对另一个域做聚合,但是过滤似乎没有起作用 { "size":0, "filter":{ "nested ...

  7. 如何在Elasticsearch中安装中文分词器(IK+pinyin)

    如果直接使用Elasticsearch的朋友在处理中文内容的搜索时,肯定会遇到很尴尬的问题--中文词语被分成了一个一个的汉字,当用Kibana作图的时候,按照term来分组,结果一个汉字被分成了一组. ...

  8. ElasticSearch中的简单查询

    前言 最近修改项目,又看了下ElasticSearch中的搜索,所以简单整理一下其中的查询语句等.都是比较基础的.PS,好久没写博客了..大概就是因为懒吧.闲言少叙书归正传. 查询示例 http:// ...

  9. elasticsearch中的mapping映射配置与查询典型案例

    elasticsearch中的mapping映射配置与查询典型案例 elasticsearch中的mapping映射配置示例比如要搭建个中文新闻信息的搜索引擎,新闻有"标题".&q ...

随机推荐

  1. 使用python处理selenium中的css_selector定位元素的模糊匹配问题

    # 匹配id,先指定一个html标签,然后加上“#”符号,再加上id的属性值 self.driver.find_element_by_css_selector('div#ID').click() # ...

  2. pat甲级 1155 Heap Paths (30 分)

    In computer science, a heap is a specialized tree-based data structure that satisfies the heap prope ...

  3. My Test about Mat

    一.创建Mat >Mat a = cv::Mat(2,2,CV_32S,1); output:  [1,1; 1,1] >Mat a = cv::Mat(2,2,CV_32SC3,1); ...

  4. 使用C#和Java发送邮件(转载)

    using System.Net.Mail; using System.Net; public class EmailEntity { private MailMessage mm; /// < ...

  5. apiman 安装&&使用

    安装测试基于docker 1. docker  image pull   docker pull apiman/on-wildfly1   2. 启动   docker run -d -p 8081: ...

  6. pthread中读写锁

    读写锁很像一个互斥量,他阻止多个线程同时修改共享数据的另一种方法,区分不同互斥量的是他是分读数据和写数据,一个读写锁允许同时多个线程读数据,只要他们不修改数据. 只要没有写模式下的加锁,任意线程都可以 ...

  7. Git 的分支和标签规则

    Git 的分支和标签规则 分支使用 x.x 命名,不加 V. 标签使用 v1.x.x-xxx 方式命名.(v 为小写) 分支和标签名不可重复.

  8. (转)Android性能优化——工具篇

    Android性能优化是Android开发中经常遇见的一个问题,接下来将对Android性能优化方面的知识点做一个简单的梳理和总结,将从工具和代码两方面进行梳理.所谓工欲善其事必先利其器,本文首先来看 ...

  9. new String(tmp,1,nlen,"UTF8")

    tmp是一个byte(字节)数组,如:['a','b','c'...],tmp[0]是去byte中的第一个,运算符&表示按位运算‘且’,就是前后值的二进制相同位有0取0,否则取1,如:2&am ...

  10. sql分割字符串详解

    create function f_split(@c varchar(2000),@split varchar(2)) returns @t table(col varchar(20)) as beg ...