@Override
        public boolean visit(Item item) {
            if (item instanceof HasIndexItem indexItem) {
                var field = schema.fieldInfo(indexItem.getIndexName());
                if (field.isEmpty()) return true;
                if (field.get().type().kind() == Field.Type.Kind.TENSOR)
                    throw new IllegalArgumentException("Cannot search for terms in '" + indexItem.getIndexName() +
                                                       "': It is a tensor field");
            }
            return true;
        }
Validation of query operators against the schema which is searched

@author bratseth
container-search/src/main/java/com/yahoo/search/searchers/QueryValidator.java