You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@metamodel.apache.org by ar...@apache.org on 2021/03/17 09:30:43 UTC

[metamodel] 03/07: MM-?: Elasticsearch, IS NULL or empty.

This is an automated email from the ASF dual-hosted git repository.

arjansh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/metamodel.git

commit 4aa20245fe5962ffde84ef2829bcce715af36589
Author: jakub <j....@quadient.com>
AuthorDate: Fri Mar 12 14:41:36 2021 +0100

    MM-?: Elasticsearch, IS NULL or empty.
---
 .../org/apache/metamodel/elasticsearch/common/ElasticSearchUtils.java | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/elasticsearch/common/src/main/java/org/apache/metamodel/elasticsearch/common/ElasticSearchUtils.java b/elasticsearch/common/src/main/java/org/apache/metamodel/elasticsearch/common/ElasticSearchUtils.java
index fc39097..6d66ca0 100644
--- a/elasticsearch/common/src/main/java/org/apache/metamodel/elasticsearch/common/ElasticSearchUtils.java
+++ b/elasticsearch/common/src/main/java/org/apache/metamodel/elasticsearch/common/ElasticSearchUtils.java
@@ -225,8 +225,6 @@ public class ElasticSearchUtils {
         if (OperatorType.EQUALS_TO.equals(filterItem.getOperator())) {
             if (filterItem.getOperand() == null) {
                 return getMissingQuery(column.getName());
-            } else if (filterItem.getOperand().equals("")) {
-                return QueryBuilders.boolQuery().mustNot(QueryBuilders.existsQuery(column.getName()));
             } else {
                 return matchOrTermQuery(column, filterItem.getOperand());
             }
@@ -250,7 +248,7 @@ public class ElasticSearchUtils {
     }
 
     private static QueryBuilder matchOrTermQuery(final Column column, final Object operand) {
-        if (column.getType().isLiteral()) {
+        if (column.getType().isLiteral() && operand != null && !operand.equals("")) {
             return QueryBuilders.matchQuery(column.getName(), operand);
         } else {
             return QueryBuilders.termQuery(column.getName(), operand);