【问题标题】:Fuzzy Like This (FLT) - ElasticSearch像这样模糊 (FLT) - ElasticSearch
【发布时间】:2013-08-10 08:53:27
【问题描述】:

我正在努力将 FLT 实施到我正在构建的原型 ES 系统中。我查看了 Elasticsearch 网站上的文档,虽然它在那里,但我似乎无法让它工作。也许有人可以给我一些关于如何做到这一点的见解。

我似乎在网络上的其他地方找不到任何这样的例子,但也许我今天的 Google 技能还没有达到标准。到目前为止,这是我设法构建的 -

$ curl -XGET 'http://127.0.0.1:9200/uber/uber/_search?'  -d '{
  "fuzzy_like_this": {
    "fields": [
      "pty_firstname",
      "pty_surname"
    ],
    "like_text": "Nathan Andew",
    "max_query_terms": 12
  }
}'

这是我在发送请求时从提示中收到的错误消息 -

{
  "error":"SearchPhaseExecutionException[Failed to execute phase [query], total failure;
          shardFailures {[u9HfJxbXRn-8ml19FKBTiA][uber][2]: SearchParseException[[uber][2]: from[-1],size[-1]:
            Parse Failure [Failed to parse source [
              {
                "fuzzy_like_this": {
                "fields": [
                  "pty_firstname",
                  "pty_surname"
                ],
                "like_text": "Nathan Andew",
                "max_query_terms": 12
                }
              }
            ]]]; nested: SearchParseException[[uber][2]: from[-1],size[-1]:
            Parse Failure [No parser for element [fuzzy_like_this]]]; }{[u9HfJxbXRn-8ml19FKBTiA][uber][0]:
          SearchParseException[[uber][0]: from[-1],size[-1]:
            Parse Failure [Failed to parse source [
              {
                "fuzzy_like_this": {
                "fields": [
                  "pty_firstname",
                  "pty_surname"
                ],
                "like_text": "Nathan Andew",
                "max_query_terms": 12
                }
              }
            ]]]; nested: SearchParseException[[uber][0]: from[-1],size[-1]:
            Parse Failure [No parser for element [fuzzy_like_this]]]; }]",
  "status":500
}

【问题讨论】:

    标签: search curl lucene elasticsearch fuzzy-search


    【解决方案1】:

    我认为您缺少 query 部分,您需要执行以下操作:

    $ curl -XPOST 'http://127.0.0.1:9200/uber/uber/_search?'  -d '
    {
      "query" : {
        "fuzzy_like_this" : {
           "fields" : ["pty_firstname", "pty_surname"],
           "like_text" : "Nathan Andew",
           "max_query_terms" : 12
        }
      }
    }'
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-06-10
    • 2014-06-07
    • 1970-01-01
    • 2021-07-01
    • 1970-01-01
    • 2017-04-04
    • 2012-05-05
    • 1970-01-01
    相关资源
    最近更新 更多