I want to find list of products by a collection of vendor ids. The query should be like this: select * from product where vendorid in({list of vendor ids}).
below is the elasticsearch query that I use:
@Query("{\"bool\" : {\"must\" : {\"bool\" : {\"should\" : [ {\"field\" : {\"vendor\" : \"?\"}}, {\"field\" : {\"vendor\" : \"?\"}} ]}}}}")
List<WarehouseProductDTO> findByVendorIds(List<Long> vendorIds);
When I run the project, it says no [query] registered for [field]
Please can someone help me?
You need to replace field
by terms
like this:
@Query("{\"bool\" : {\"must\" : {\"bool\" : {\"should\" : [ {\"terms\" : {\"vendor\" : ?0}} ]}}}}")
List findByVendorIds(List vendorIds);
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.