thomasmueller commented on code in PR #2346:
URL: https://github.com/apache/jackrabbit-oak/pull/2346#discussion_r2159051485


##########
oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elastic/query/ElasticRequestHandler.java:
##########
@@ -1123,7 +1127,20 @@ private Query createQuery(String propertyName, 
Filter.PropertyRestriction pr, Pr
         final String field = 
elasticIndexDefinition.getElasticKeyword(propertyName);
 
         if (pr.isNullRestriction()) {
-            return Query.of(q -> q.bool(b -> b.mustNot(m -> m.exists(e -> 
e.field(field)))));
+            // nullProps check has been added since 1.4.0. Use the old 
strategy when version is lower
+            if 
(elasticIndexDefinition.getMappingVersion().compareTo(MINIMUM_NULL_CHECK_VERSION)
 < 0) {
+                // check if the default mapping is >= 1.5.0
+                if (ElasticIndexDefinition.MAPPING_VERSION != null &&
+                        ElasticIndexDefinition.MAPPING_VERSION.compareTo(new 
ElasticSemVer(1, 5, 0)) >= 0) {
+                    LOG.error("Backward compatibility for null check is not 
supported anymore. Query results may be incorrect. " +
+                            "Please reindex to update the internal mapping 
version.");
+                } else {
+                    LOG.warn("Using deprecated null check strategy for field: 
{}. Please reindex tho update the internal mapping version. " +

Review Comment:
   ```suggestion
                       LOG.warn("Using deprecated null check strategy for 
field: {}. Please reindex to update the internal mapping version. " +
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: oak-dev-unsubscr...@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to