diff --git a/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/PropertyInexistenceImpl.java b/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/PropertyInexistenceImpl.java
index 6ad156b585..5cd0db21dc 100644
--- a/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/PropertyInexistenceImpl.java
+++ b/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/PropertyInexistenceImpl.java
@@ -63,7 +63,7 @@ public class PropertyInexistenceImpl extends ConstraintImpl {
         String name = PathUtils.getName(pn);
         for (String p : PathUtils.elements(relativePath)) {
             if (t == null || !t.exists()) {
-                return false;
+                return true;
             }
             if (p.equals("..")) {
                 t = t.isRoot() ? null : t.getParent();
@@ -73,7 +73,7 @@ public class PropertyInexistenceImpl extends ConstraintImpl {
                 t = t.getChild(p);
             }
         }
-        return t != null && t.exists() && !t.hasProperty(name);
+        return t == null || !t.exists() || !t.hasProperty(name);
     }
 
     @Override
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/query/PropertyIndexistenceTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/query/PropertyIndexistenceTest.java
new file mode 100644
index 0000000000..fce812443c
--- /dev/null
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/query/PropertyIndexistenceTest.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.jackrabbit.oak.query;
+
+import com.google.common.collect.ImmutableList;
+import org.apache.jackrabbit.oak.InitialContent;
+import org.apache.jackrabbit.oak.Oak;
+import org.apache.jackrabbit.oak.api.ContentRepository;
+import org.apache.jackrabbit.oak.api.Tree;
+import org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider;
+import org.junit.Test;
+
+public class PropertyIndexistenceTest extends AbstractQueryTest {
+    @Override
+    protected ContentRepository createRepository() {
+        return new Oak()
+                .with(new OpenSecurityProvider())
+                .with(new InitialContent())
+                .createContentRepository();
+    }
+
+    @Test
+    public void inexistence() throws Exception {
+        Tree rootTree = root.getTree("/").addChild("a");
+
+        rootTree.addChild("x").addChild("y");
+        root.commit();
+
+        assertQuery("SELECT * FROM [nt:base] WHERE ISDESCENDANTNODE('/a') AND [z] IS NULL",
+                ImmutableList.of("/a/x", "/a/x/y"));
+        assertQuery("SELECT * FROM [nt:base] WHERE ISDESCENDANTNODE('/a/x') AND [z] IS NULL",
+                ImmutableList.of("/a/x/y"));
+    }
+
+    @Test
+    public void relativeInexistence() throws Exception {
+        Tree rootTree = root.getTree("/").addChild("a");
+
+        rootTree.addChild("x").addChild("y");
+        rootTree.addChild("x1");
+        root.commit();
+
+        assertQuery("SELECT * FROM [nt:base] WHERE ISDESCENDANTNODE('/a') AND [y/z] IS NULL",
+                ImmutableList.of("/a/x", "/a/x/y", "/a/x1"));
+
+        assertQuery("SELECT * FROM [nt:base] WHERE ISDESCENDANTNODE('/a/x') AND [y/z] IS NULL",
+                ImmutableList.of("/a/x/y"));
+
+        rootTree.addChild("x2").addChild("z").setProperty("y", "bar");
+        rootTree.addChild("x2").addChild("z1").addChild("y").setProperty("z", "bar");
+        root.commit();
+
+        assertQuery("SELECT * FROM [nt:base] WHERE ISDESCENDANTNODE('/a/x2') AND [y/z] IS NULL",
+                ImmutableList.of("/a/x2/z", "/a/x2/z1/y"));
+    }
+}
