我正在尝试一个标题或正文为“ prueba”的课程:
查询:
{
"query": {
"filtered": {
"query" : {
"multi_match": {
"query": "prueba",
"fields": ["title","body"]
}
}
}
}
}
结果:
{
"_index": "content",
"_type": "comment_thread",
"_id": "5c3c79298115f61cc2000000",
"_score": 1.4054651,
"_source": {
"_id": "5c3c79298115f61cc2000000",
"body": "Hola esto es una prueba",
"commentable_id": "course",
"context": "course",
"course_id": "course-v1:edx+CC101+2019_T1",
}
Okey,太完美了。现在,我想进行相同的搜索,但要添加确切的course_id。所以:
查询:
{
"query": {
"filtered": {
"query" : {
"multi_match": {
"query": "prueba",
"fields": ["title","body"]
}
},
"filter": {
"bool": {
"must": {
"term" : { "course_id": "course-v1:edx+CC101+2019_T1" }
}
}
}
}
}
}
结果:0次点击
但是如果我放"term" : { "course_id": "course" }
,请返回课程。...
这是怎么回事?
映射:
"course_id": {
"type": "string"
},
ElasticSearch版本:
{
"status" : 200,
"name" : "MN-E (Ultraverse)",
"cluster_name" : "elasticsearch",
"version" : {
"number" : "1.5.2",
"build_hash" : "62ff9868b4c8a0c45860bebb259e21980778ab1c",
"build_timestamp" : "2015-04-27T09:21:06Z",
"build_snapshot" : false,
"lucene_version" : "4.10.4"
},
"tagline" : "You Know, for Search"
}