service class:
String linkname = StringUtils.join(link, "\", \"");
String querylink = StringUtils.wrap(linkname, "\"");
String query = "{"+"\"linkname\":["+querylink +"]}";
res = elasticsearchRepo.getMethod(querylink, PageRequest.of(page-1, pageSize));
repo class :
@Query("{\"bool\":{\"filter\":[{\"terms\":?0}]}}")
Page<Testtables> getMethod(String query,Pageable pageable);
Same code was working fine with springboot-starter-data-elastcisearch version 2.2.7.RELEASE with 6.8.8 spring-data-elasticsearch (3.2.7.RELEASE parent)
but getting exception with springboot-starter-data-elastcisearch version 2.2.14 with 7.17.11 spring-data-elastcisearch ( 4.4.14 parent)
Exception:
reason=Unexpected character ('' (code 92)): was expecting double-quote to start field name at [Source: [B@7192df39; line: 1, column: 31]]
@Query("{"bool":{"filter":[{"terms":{"linkname": ?0}}]}}")
As Val Suggested in comments passing values in ?0 and rest as static string worked for us ..Thank you
we tested with springboot version is 2.7.14