【发布时间】:2019-12-15 15:15:16
【问题描述】:
我有一个查询,我正在尝试通过 Elastic Search 6.4.2 获取结果。
它正在工作。但是当我应用应该在 NewsArticle 类型下的标签部分时,它会返回 CaseStudyPage 类型的结果。
我这样做对吗?
基本上我想对 NewsArticle 类型的子过滤标签,但它似乎不能正常工作。
我尝试了许多不同的格式,我在 StackOverflow 和各种网页上找到了这些格式。
"highlight":{
"pre_tags":[
""
],
"post_tags":[
"<\/strong>"
],
"fields":{
"*":{
}
},
"require_field_match":false,
"fragment_size":100,
"number_of_fragments":3,
"highlight_query":{
"query_string":{
"query":"",
"analyze_wildcard":true,
"default_operator":"AND"
}
}
},
"sort":[{"PublishedDate":"desc"}],
"size":5000,
"query":{
"bool":{
"filter":{
"bool":{
"should":[
{
"terms":{
"ClassName":[
"CaseStudyPage"
]
}
},
{
"bool":{
"must": [
{
"terms":{
"ClassName":[
"NewsArticle"
]
}
},
{
"terms":{
"Tags.ID":[
"9"
]
}
}
]
}
}
]
}
}
}
}
}
没有错误消息。它带回了 Tag.ID = 9 的 CaseStudyPage 和 NewsArticle 的结果。但它应该只带回只有 Tag.ID = 9 的 CaseStudyPage(完整结果)和 NewsArticle 结果。
结果返回来自 CaseStudyPage 类型和 NewsArticle 类型的标记内容,但它应该只显示来自 NewsArticle 类型和所有 CaseStudyPage 类型的标记内容。
【问题讨论】:
-
你能更新最后一部分吗?在“没有错误消息”之后。没看懂
标签: php json elasticsearch