I am using Elastic search repository as per https://docs.spring.io/spring-data/elasticsearch/docs/current/reference/html/#elasticsearch.repositories only to read an existing indexed data.
I have an analysed field let's say fullName, for which I am creating s search method in repository as follows: Person.Java
class Person{
@Field("ID")
@Id
long _id;
@Field(value = "FULL_NAME", type = FieldType.Text)
String fullName;
}
Repository is as:
@Repository
public interface PersonDataRepository extends ElasticsearchRepository<Person, Long> {
//this does't work
List<Person> findAllByFullNameIn(List<String> fullNames);
//this works
List<Person> findAllByFullName(String fullName);
}
Since the field is analysed, PersonDataRepository.findAllByFullNameIn(Stream.of("ABC").collect(Colelctors.toList())) doesn't produce any results, while PersonDataRepository.findAllByFullName("ABC") works well.
I found out that this is due to the analysed String field and If I switch to keyword, it should work.
Anybody knows a way around this using Spring data elasticsearch?
Versions: Springboot - 2.3.1.RELEASE Spring Data Elasticsearch: 4.0.1.RELEASE ElasticSearch - 7.6.2