热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

elasticsearchExistsQuery

ExistsQueryeditExistsQueryeditExistsQueryeditExistsQueryeditReturnsdocumentsthathaveatleas

Exists Queryedit

Returns documents that have at least one non-null value in the original field:

GET /_search
{
    "query": {
        "exists" : { "field" : "user" }
    }
}
 

For instance, these documents would all match the above query:

{ "user": "jane" }
{ "user": "" } 
技术分享图片
{ "user": "-" } 
技术分享图片
{ "user": ["jane"] }
{ "user": ["jane", null ] } 
技术分享图片

技术分享图片

An empty string is a non-null value.

技术分享图片

Even though the standard analyzer would emit zero tokens, the original field is non-null.

技术分享图片

At least one non-null value is required.

These documents would not match the above query:

{ "user": null }
{ "user": [] } 
技术分享图片
{ "user": [null] } 
技术分享图片
{ "foo":  "bar" } 
技术分享图片

技术分享图片

This field has no values.

技术分享图片

At least one non-null value is required.

技术分享图片

The user field is missing completely.

null_value mappingedit

If the field mapping includes the null_value setting then explicit null values are replaced with the specified null_value. For instance, if the user field were mapped as follows:

PUT /example
{
  "mappings": {
    "doc": {
      "properties": {
        "user": {
          "type": "keyword",
          "null_value": "_null_"
        }
      }
    }
  }
}
 

then explicit null values would be indexed as the string _null_, and the following docs would match the exists filter:

{ "user": null }
{ "user": [null] }

However, these docs—without explicit null values—would still have no values in the user field and thus would not match the exists filter:

{ "user": [] }
{ "foo": "bar" }

missing queryedit

There isn’t a missing query. Instead use the exists query inside a must_not clause as follows:

GET /_search
{
    "query": {
        "bool": {
            "must_not": {
                "exists": {
                    "field": "user"
                }
            }
        }
    }
}

elasticsearch--- Exists Query


推荐阅读
  • socket8 [命名管道]
    ::命名管道不但能实现同一台机器上两个进程通信,还能在网络中不同机器上的两个进程之间的通信机制。与邮槽不同,命名管道是采用基于连接并且可靠的传输方式,所以命名管道传输数据只能一对一 ... [详细]
  • 搜索栏算是UI中很简单的一个操作了,拖一个搜索栏上来。   搜索栏中比较重要的属性是占位符,也就是图中右侧的Placeholder,比如输入“请输入关键字”,显示如下: ... [详细]
  • Git是一个开源的分布式版本控制系统,用以有效、高速的处理从很小到非常大的项目版本管理,现在在企业中的使用率也是很广的。git是一个分布式的版本控制系统,不像以前的svn,svn是 ... [详细]
  • CentOS 7.6网卡绑定mode1
    CentOS7.6网卡绑定mode1[root@server~]#systemctlstopNetworkManager[root@server~]#systemctldisabl ... [详细]
  • Postman工具使用教程
    Postman的基础功能1.GET请求GET请求:点击Params,输入参数及value,可输入多个,即时显示在URL链接上,所以,GET请求的请求头与请求参数如在接口文档中无特别 ... [详细]
  • 1011-MarriageCeremoniesPDF(English)StatisticsForumTimeLimit:2second(s)MemoryLimit:32MBYouw ... [详细]
  • 726:ROADS726:ROADS总时间限制:1000ms内存限制:65536kB描述Ncitiesnamedwithnumbers1Nareconnectedwithon ... [详细]
  • 调用:视图调用:1@Html.DropDownListFor(tt.HrEmpGuid,ViewData[Emp] as SelectList, new {@class   ... [详细]
  • salesforce lightning零基础学习(七) 列表展示数据时两种自定义编辑页面
    上一篇Lightning内容描述的是LDS,通过LDS可以很方便的实例化一个对象的数据信息。当我们通过列表展示数据需要编辑时,我们常使用两种方式去处理编辑页面:PopUpWindo ... [详细]
  • [No000057]一个人默默背单词,小心被传染哦
    不日凛冬将至,全国各地,已有多名少侠因季节变化,出现了不同程度的四肢不勤、bd不分的症状。具体表现为——包大人在此高能预警:不想背单词,有可能你已经被传染了。好好的,怎么突然不想背 ... [详细]
  • 题目链接:http:poj.orgproblem?id1905题目大意:竹竿受热会膨胀。设其原长为L,受热膨胀后的长度L'(1+n*C)*L,其中n,C,L都是要输入的参数 ... [详细]
  • 1.EF跟LINQ不是一码事儿。2.LINQtoEF是LINQ的一个provider,LINQtoSQL也是LINQ的一个provider。LINQtoEF是LINQtoSQL的替 ... [详细]
  • Matplotlib笔记:设置画布属性并保存图片(figsize,dpi,savefig)
    设置画布属性并保存图片importmatplotlib.pyplotaspltplt.figure(figsize(10,4),dpi80)#图片长宽和清晰度plt.p ... [详细]
  • PICT初探索
    pict用于测试用例的生成,非常高效。也非常方便。安装完成后主要程序就一个exe文件。需要通过cmd命令行进入pict文件夹。建立测试用例文件然后使用简单的命令行生成测试用例也可以 ... [详细]
  • 内存暴增排查分析
    一次偶然间,发现测试环境iis站点内存突然间暴增,平常都是300M,这次一下子暴增到8g于是就开始了接下来的分析发现Dictionary居然有1.78g懵逼windbg分析1.看看 ... [详细]
author-avatar
黄董一叶知秋_821
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有