如何在ElasticSearch中搜索自引用文档?
public class ProductDocument {
@Id
private String id;
private String title;
private List<String> tags;
//private List<ProductDocument> relatedProducts -- Doesn't work
private List<String> relatedProducts;
}
因此,在搜索时,我希望执行以下操作
x一个一个一个一个x一个一个二个x
怎么才能做到呢?我到处找了找,到目前为止什么也没找到。任何帮助都是非常感谢的
1条答案
按热度按时间o0lyfsai1#
需要使用嵌套类型
然后,在执行搜索时,可以使用嵌套查询在相关产品字段中搜索匹配项。以下是如何执行此操作的示例: