简体   繁体   English

无法在ElasticSearch中链接match_phrase_prefix

[英]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.

相关问题 ElasticSearch - match_phrase_prefix 查询同义词 - ElasticSearch - match_phrase_prefix query with synonyms 多查询match_phrase_prefix elasticsearch - Multi-query match_phrase_prefix elasticsearch elasticsearch match_phrase_prefix查询不适用于analyzer_startswith - elasticsearch match_phrase_prefix query not working with analyzer_startswith AWS OpenSearch/ElasticSearch match_phrase_prefix 查询不适用于节点 - AWS OpenSearch/ElasticSearch match_phrase_prefix query doen't work for a node 用于HibernateSearch的match_phrase_prefix查询 - match_phrase_prefix query for HibernateSearch 在土耳其语字符上使用 match_phrase_prefix 搜索时,Elasticsearch 出现意外结果 - Elasticsearch unexpected result while searching with match_phrase_prefix on turkish characters 是否可以在 Percolated Elasticsearch 查询中包含 match_phrase_prefix 和 slop 等功能? - Is it possible to include features like match_phrase_prefix and slop in Percolated Elasticsearch query? Elatisearch match_phrase_prefix 查询,前缀完全匹配 - Elatisearch match_phrase_prefix query, with exact prefix match 将boost by field添加到前缀和match_phrase_prefix查询 - adding boost by field to a prefix and match_phrase_prefix queries 在弹性搜索中未使用match_phrase_prefix获得匹配 - Match is not obtained by using match_phrase_prefix in elastic search
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM