返回suggester的类型(Returning the type of the suggester)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了返回suggester的类型(Returning the type of the suggester)相关的知识,希望对你有一定的参考价值。

Returning the type of the suggester

  有时你需要知道确切的suggester类型,以解析其结果。 typed_keys参数可用于在响应中更改suggester的名称,它将以其类型为前缀。

  考虑以下两个suggester term 和phrase的例子:

POST _search?typed_keys
{
  "suggest": {
    "text" : "some test mssage",
    "my-first-suggester" : {
      "term" : {
        "field" : "message"
      }
    },
    "my-second-suggester" : {
      "phrase" : {
        "field" : "message"
      }
    }
  }
}

  在回应中,suggester命名将分别改为term#my-first-suggester和phrase#my-second-suggester,以反映每个suggestion的类型:

{
  "suggest": {
    "term#my-first-suggester": [ 【1】
      {
        "text": "some",
        "offset": 0,
        "length": 4,
        "options": []
      },
      {
        "text": "test",
        "offset": 5,
        "length": 4,
        "options": []
      },
      {
        "text": "mssage",
        "offset": 10,
        "length": 6,
        "options": [
          {
            "text": "message",
            "score": 0.8333333,
            "freq": 4
          }
        ]
      }
    ],
    "phrase#my-second-suggester": [ 【2】
      {
        "text": "some test mssage",
        "offset": 0,
        "length": 16,
        "options": [
          {
            "text": "some test message",
            "score": 0.030227963
          }
        ]
      }
    ]
  },
  ...
}

  【1】名字my-first-suggester现在包含term前缀。 

  【2】名字my-second-suggester现在包含phrase前缀。

 

 

原文地址:https://www.elastic.co/guide/en/elasticsearch/reference/5.4/returning-suggesters-type.html

以上是关于返回suggester的类型(Returning the type of the suggester)的主要内容,如果未能解决你的问题,请参考以下文章

Postgresql INSERT RETURNING 复杂类型

RETURNING 的别名导致 jooq

如何从具有 RETURNING 子句的动态 SQL 返回集合

尝试使用 RETURNING 和更新/插入从 plpgsql 函数返回时出错

WKWebView _WebFilterIsActive returning: NO

使用 FORALL 和 RETURNING 插入表时如何获取 ROWID