私は古いプロジェクトを維持するために取り組んでいます。
私が使用しているelasticsearchのバージョンは1.7ですが、これは私の問題と関連していないと思います。フィルタリングされたクエリのクエリとコレクション
私はいくつかの教師の書類を持っている:
{
"id": 244,
"degree": [],
"teacherDiplomaRelation": [],
"user": {
"enabled": true
},
"teacherClassDisciplineRelation": [
SEE BELOW
}
teacherClassDisciplineRelationは(私が持っているすべてのカップルのlevelTree /調教用)N回このフォーマットである
{
"levelTree": {
"id": 34,
"label": "1st year of college",
"slugLastLevelDisplay": "college"
},
"discipline": {
"id": 1,
"label": "Maths",
"slug": "maths"
},
"cityLocation": "10.1010,10.1010"
}
今、私はすべてを取得したいです教師を有効にし、学問分野で数学を持つ。私のクエリは次のとおりです。
{
"query": {
"filtered": {
"filter": {
"bool": {
"must": [
{
"term": {
"user.enabled": true
}
},
{
"term": {
"teacherClassDisciplineRelation.discipline.slug": "maths"
}
}
]
}
}
}
},
"size": {
"from": 0,
"size": 15
}
}
マッピング:
"teacherClassDisciplineRelation": {
"type": "nested",
"properties": {
"cityLocation": {
"type": "geo_point",
"store": true
},
"discipline": {
"properties": {
"id": {
"type": "string",
"store": true
},
"label": {
"type": "string",
"boost": 7.0,
"store": true,
"analyzer": "custom_analyzer"
},
"slug": {
"type": "string",
"boost": 7.0,
"index": "not_analyzed",
"store": true,
"norms": {
"enabled": true
}
}
}
}
問題:
"user.enabled": true
と私のクエリは私にいくつかの結果が得られ、 は"teacherClassDisciplineRelation.discipline.slug": "maths"
と私のクエリはいつも私に0結果を与えますが、私は」インデックスをチェックしました私はいくつかの結果が必要です。
私はelasticsearchの新作ですが、なぜ私の結果が常に0であるかを知ることができません。 理由は何ですか?
マッピングを共有してください。 'GET index_name/type_name/_mapping' – Richa
@リチャ私はちょうどそれを追加しました – goto