我目前正在通过我的 java Application 进行弹性搜索。我知道如何使用 RestHighLevelClient 索引 Java pojo。我怎样才能只在新领域而不是完整的pojo上进行搜索。?
public class Employee{
private long id;
private String name;
private String designation;
private String address; //want to index but not searchable in elastic search
}
我的索引代码如下,运行良好:
public String saveToEs(Employee employee) throws IOException {
Map<String, Object> map = objectMapper.convertValue(employee, Map.class);
IndexRequest indexRequest =
new IndexRequest(INDEX, TYPE, employee.getId().toString()).source(map, XContentType.JSON);
IndexResponse indexResponse = client.index(indexRequest, RequestOptions.DEFAULT);
我需要在 java 中执行此操作。请提供帮助或好的链接?