2

Spring data elastic search repository doesn't work as expexcted. For the method below, it gives the following exception.

org.springframework.dao.InvalidDataAccessApiUsageException: Illegal criteria found 'IS_NULL (0): [IsNull, Null]'.

public interface CustomerRepository extends ElasticsearchRepository<Customer, Long> {

   List<Customer> findByFirstNameIsNull();

}

1 Answer 1

1

You can write something like below in the repository:

Page<Customer> findByFirstName(String firstName, Pageable pageable);

And calling it with

findByFirstName(null, PageRequest.of(0,100));

Will give you the first 100 results that have null values in their first names.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.