[英]Can't chain match_phrase_prefix in ElasticSearch
I am trying to chain more than one match_phrase_prefix queries, but for some reason it doesn't return any results (also no errors). 我正在尝试链接多个match_phrase_prefix查询,但是由于某种原因,它不返回任何结果(也没有错误)。 When i try just one match_phrase_prefix everything works just fine.
当我只尝试一个match_phrase_prefix时,一切正常。 I am using Elastic Search version 2.3 and my query looks like this:
我使用的是Elastic Search 2.3版,查询如下:
"query": {
"bool": {
"must": [
{
"match_phrase_prefix": {
"title": "נפ"
}
},
{
"match_phrase_prefix": {
"sub_title": "נפצ"
}
}
]
}
}
my mapping for the specific index is: 我对特定索引的映射是:
{
"wcm_articles": {
"mappings": {
"article": {
"properties": {
"approved_talkbacks_counter": {
"type": "integer"
},
"article_link": {
"type": "string",
"index": "not_analyzed"
},
"author": {
"type": "string",
"analyzer": "hebrew"
},
"category_id": {
"type": "string",
"index": "not_analyzed"
},
"date_updated": {
"type": "date",
"format": "date_hour_minute_second"
},
"is_old": {
"type": "boolean"
},
"is_promoted": {
"type": "boolean"
},
"is_video": {
"type": "boolean"
},
"last_update_user": {
"type": "string",
"index": "not_analyzed"
},
"launch_date": {
"type": "date",
"format": "date_hour_minute_second"
},
"plain_text": {
"type": "string",
"analyzer": "hebrew"
},
"promotion_notes": {
"type": "string",
"index": "not_analyzed"
},
"status": {
"type": "string",
"index": "not_analyzed"
},
"sub_title": {
"type": "string",
"analyzer": "hebrew"
},
"tags": {
"type": "string",
"index": "not_analyzed"
},
"title": {
"type": "string",
"analyzer": "hebrew"
},
"type": {
"type": "string",
"index": "not_analyzed"
},
"waiting_talkbacks_counter": {
"type": "integer"
}
}
}
}
} } }}
And some example documents are: 一些示例文档是:
"_index": "wcm_articles",
"_type": "article",
"_id": "2828280",
"_score": 2.5246792,
"_source": {
"tags": [],
"category_id": 3,
"sub_title": "",
"promotion_notes": "",
"is_old": false,
"last_update_user": "",
"status": 1,
"type": "article",
"plain_text": "",
"launch_date": null,
"waiting_talkbacks_counter": 0,
"approved_talkbacks_counter": 0,
"is_video": false,
"article_link": "",
"date_updated": "2016-12-05T15:12:10",
"title": "קשישה כבת 80 נפצעה קשה מפגיעת רכב בחולון ",
"author": "",
"is_promoted": false
"_index": "wcm_articles",
"_type": "article",
"_id": "2829275",
"_score": 2.1283152,
"_source": {
"tags": [],
"category_id": 3,
"sub_title": "",
"promotion_notes": "",
"is_old": false,
"last_update_user": "",
"status": 1,
"type": "article",
"plain_text": "",
"launch_date": null,
"waiting_talkbacks_counter": 0,
"approved_talkbacks_counter": 0,
"is_video": false,
"article_link": "",
"date_updated": "2016-12-05T15:12:16",
"title": "רוכבת אופנוע נפצעה קשה בתאונת דרכים בצומת סירקין בפ\"ת",
"author": "",
"is_promoted": false
OK my issue is solved. 好,我的问题解决了。 There was no problem with chaining the queries.
链接查询没有问题。 I was not using "match_phrase_prefix" the correct way, it wont work with a single word, only when you use it with more than one word, for a single word the correct query for the purpose of a form of autocomplete search (a search that includes a part of a word and not a whole word) is - "prefix".
我没有以正确的方式使用“ match_phrase_prefix”,它不能与单个单词一起使用,只有当您将其与多个单词一起使用时,对于单个单词而言,正确的查询才是自动完成搜索形式(包括单词的一部分而不是整个单词)是-“前缀”。 when chaining any combination of these two and used correctly for each - there is no problem at all.
链接这两者的任何组合并正确使用它们时-完全没有问题。
Hope this helps someone else with a similar problem. 希望这可以帮助其他有类似问题的人。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.