0
ES 스키마는 다중 중첩 된 코스 문서가 포함 된 학생 문서를 모델링합니다. 더 (내가 수학 및 경제학을 촬영 한 모든 학생들을 조회 할AND 조건을 가진 Elasticsearch Nested doc
{
"_index": "index_classroom",
"_type": "content",
"_id": "6170_130",
"_score": 0.72833073,
"_source": {
"courses": [
{
"name": "maths",
"grade": "A"
},
{
"name": "economics",
"grade": "A+"
}
]
}
}
:
{
"index_classroom": {
"mappings": {
"content": {
"dynamic": "false",
"properties": {
"courses": {
"type": "nested",
"properties": {
"grade": {
"type": "integer"
},
"name": {
"type": "string",
"analyzer": "analyzer_keyword"
}
}
}
}
}
}
}
}
샘플 문서 : 나는 물론 X와 Y
매핑을 가지고 학생들을 검색하려면 추가는 "생물학이 아니라"입니다.
고마워요!
{
"query": {
"bool": {
"must": [
{
"nested": {
"path": "courses",
"query": {
"match": {
"courses.name": "economics"
}
}
}
},
{
"nested": {
"path": "courses",
"query": {
"match": {
"courses.name": "maths"
}
}
}
}
],
"must_not": [
{
"nested": {
"path": "courses",
"query": {
"match": {
"courses.name": "Biology"
}
}
}
}
]
}
}
}
나는 탄성 2.3.3을 사용하고 있습니다 : – lazywiz