Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
<img src="//i.stack.imgur.com/RUiNP.png" height="16" width="18" alt="" class="sponsor tag img">elasticsearch 弹性搜索优先排序以搜索词开头的搜索结果_<img Src="//i.stack.imgur.com/RUiNP.png" Height="16" Width="18" Alt="" Class="sponsor Tag Img">elasticsearch_Lucene_Full Text Search_Search Engine - Fatal编程技术网 elasticsearch 弹性搜索优先排序以搜索词开头的搜索结果,elasticsearch,lucene,full-text-search,search-engine,elasticsearch,Lucene,Full Text Search,Search Engine" /> elasticsearch 弹性搜索优先排序以搜索词开头的搜索结果,elasticsearch,lucene,full-text-search,search-engine,elasticsearch,Lucene,Full Text Search,Search Engine" />

elasticsearch 弹性搜索优先排序以搜索词开头的搜索结果

elasticsearch 弹性搜索优先排序以搜索词开头的搜索结果,elasticsearch,lucene,full-text-search,search-engine,elasticsearch,Lucene,Full Text Search,Search Engine,我需要对以搜索词开头的搜索结果进行优先级排序。我用了“匹配短语前缀”。我用了“匹配短语前缀”。但不起作用。 详情: 质疑 GET /test/products/_search?pretty { "query": { "match_phrase_prefix": { "title": "iphone 5c" } } } 映射 curl -XGET

我需要对以搜索词开头的搜索结果进行优先级排序。我用了“匹配短语前缀”。我用了“匹配短语前缀”。但不起作用。

详情:

  • 质疑

    GET /test/products/_search?pretty { "query": { "match_phrase_prefix": { "title": "iphone 5c" } } }
  • 映射

    curl -XGET 'localhost:9200/test/_analyze?analyzer=standard&pretty' -d 'Capa Bumper Iphone 5C' | grep token
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100   532  100   511  100    21  32800   1347 --:--:-- --:--:-- --:--:-- 34066
      "tokens" : [ {
        "token" : "capa",
        "token" : "bumper",
        "token" : "iphone",
        "token" : "5c",
    
    “映射”:{ “产品”:{ “财产”:{ “标题”:{ “类型”:“字符串”, “分析器”:“巴西人” } } } }


在本例中,我需要的第一个结果是设备(Iphone 5c)



分析仪的使用导致了标记化问题。下面看看您的文档字段是如何标记的

您需要使用关键字标记器

在映射中添加关键字标记器:


在捕获第一个令牌的情况下,会是什么? "mappings": { "products": { "properties": { "title": { "type": "string", "analyzer": "brazilian" } } } }
curl -XGET 'localhost:9200/test/_analyze?analyzer=standard&pretty' -d 'Capa Bumper Iphone 5C' | grep token
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   532  100   511  100    21  32800   1347 --:--:-- --:--:-- --:--:-- 34066
  "tokens" : [ {
    "token" : "capa",
    "token" : "bumper",
    "token" : "iphone",
    "token" : "5c",