나는이 세 가지 tables.Their 구조와 같은 -적용하여 중첩 된 필드의 데이터가 탄성 검색 쿼리해야 얻을
public class RcItem{
@OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL, mappedBy = "rcItem")
@JsonManagedReference
private Set<RcItemRegulation> rcItemRegulations = new HashSet<>();
}
public class RcItemRegulation{
@ManyToOne
@JoinColumn(name = "rc_item_id")
@Field(type = FieldType.Nested, index = FieldIndex.analyzed, analyzer = "lowercase_keyword", store = true)
@JsonBackReference
private RcItem rcItem;
@ManyToOne
@JoinColumn(name = "rgltn_id")
@Field(type = FieldType.Nested, index = FieldIndex.analyzed, analyzer = "lowercase_keyword", store = true)
private Regulation regulation;
}
public class Regulation{
@OneToMany(cascade = CascadeType.ALL, mappedBy = "regulation")
@JsonManagedReference
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
private Set<RcItemRegulation> rcItemRegulations = new HashSet<>();
@Column(name = "rgltn_full_name")
@Field(type = FieldType.String, index = FieldIndex.analyzed, analyzer = "lowercase_keyword", store = true)
private String rgltnFullName;
}
처럼 내 데이터 구조에서이 위의 데이터 인덱스 -이를 위해
"rcItemRegulations": [
{
"id": 1,
"rcItemRgltnType": "primary",
"regulation": {
"rgltnFullName": "17 ABC § 1.12(f)(5)(i)(B)"
}
}]
g이이 내게 도움이 exist.Please 경우에도 나에게 빈 결과 배열을 제공
{"query":{
"bool" : {
"must" : {
"bool" : {
"must" : [ {
"term" : {
"rcItemRegulations.rcItemRgltnType" : "primary"
}
}, {
"term" : {
"rcItemRegulations.regulation.rgltnFullName" : "17 ABC § 1.12(f)(5)(i)(B)"
}
} ]
}
}
}
}
}
- 나는 탄성 검색 쿼리를 시도 탄성 검색의 데이터.
'중첩 된'및 '경로'를 사용해야합니다. 이 예제를 확인하십시오. https://www.elastic.co/guide/en/elasticsearch/guide/current/nested-query.html – pvpkiran