简体   繁体   English

Elasticsearch - 检查参数是否不为空

[英]Elasticsearch - check if the parameter is not empty

In SQL, we can perform the following in the where clause:在SQL中,我们可以在where子句中进行如下操作:

SELECT * FROM tbl WHERE :parameter <> '' OR :parameter is not null

Is this possible in elastic search to check if the input parameter/value is not null or empty?这是否可以在弹性搜索中检查输入参数/值是否不是 null 或为空? I checked the exists query but the parameter is a field, not a value.我检查了存在的查询,但参数是一个字段,而不是一个值。

You can use SQL API or using Exists Query .您可以使用SQL API或使用Exists Query

Ex:前任:

POST /_sql?format=txt
{
   "query": "SELECT * FROM bar WHERE Id <> '' AND Id is not null"
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM