Can someone shed light on this, I've followed the example here:
...However, the syntax cannot possibly work. It results in syntax errors similar to below image. (Needless to say this does not compile)
I've attempted to escape the quotes, but the resulting elastic
query does not work with below exception:
The thing is, other examples I've found are using the similar format and of course don't work: Spring Data elasticsearch @Query annotation for nested objects
Any ideas?
You have two issues:
A. The field
query does not exist anymore, you need to use either match
or term
(the error message says "no query registered for [field]")
{"bool": {"must": {"term": {"name": "?0"}}}}
B. You need to escape the double quotes inside your query (as you can see your IDE is red-lining your query)
@Query("{\"bool\": {\"must\": {\"term\": {\"name\": \"?0\"}}}}")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.