feat(es):
This commit is contained in:
parent
93491b2713
commit
fe7cf8b63f
|
@ -19,6 +19,8 @@ import io.minio.GetObjectArgs;
|
||||||
import io.minio.MinioClient;
|
import io.minio.MinioClient;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import org.elasticsearch.action.search.SearchResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
@ -202,14 +204,28 @@ public class DemoController {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("demo222")
|
@GetMapping("demo333")
|
||||||
public Result<?> demo222() {
|
public Result<?> demo333() {
|
||||||
System.out.println("111111111111"+productEsMapper.search(new LambdaEsQueryWrapper<ProductDocument>()
|
// 执行ES查询并格式化打印结果
|
||||||
.eq(ProductDocument::getPrice, 8999)));
|
LambdaEsQueryWrapper<ProductDocument> wrapper = new LambdaEsQueryWrapper<>();
|
||||||
|
wrapper.eq(ProductDocument::getPrice, 8999);
|
||||||
System.out.println(productEsMapper.search(new LambdaEsQueryWrapper<ProductDocument>()
|
|
||||||
.eq(ProductDocument::getPrice, 8999)).getHits().getHits());
|
List<ProductDocument> products = productEsMapper.selectList(wrapper);
|
||||||
|
|
||||||
|
System.out.println("\n=== ES查询结果 ===");
|
||||||
|
if (products.isEmpty()) {
|
||||||
|
System.out.println("未找到匹配的文档");
|
||||||
|
} else {
|
||||||
|
products.forEach(product -> {
|
||||||
|
System.out.println("\n商品ID: " + product.getId());
|
||||||
|
System.out.println("商品名称: " + product.getName());
|
||||||
|
System.out.println("商品价格: " + product.getPrice());
|
||||||
|
System.out.println("商品分类: " + product.getCategory());
|
||||||
|
System.out.println("商品描述: " + product.getDescription());
|
||||||
|
System.out.println("------------------------");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return Result.success("demo222");
|
return Result.success("demo222");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue