Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/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 Elasticsearch-Can';t使用建议字段进行搜索(“;不是完成建议字段”;)_<img Src="//i.stack.imgur.com/RUiNP.png" Height="16" Width="18" Alt="" Class="sponsor Tag Img">elasticsearch_Autocomplete - Fatal编程技术网 elasticsearch Elasticsearch-Can';t使用建议字段进行搜索(“;不是完成建议字段”;),elasticsearch,autocomplete,elasticsearch,Autocomplete" /> elasticsearch Elasticsearch-Can';t使用建议字段进行搜索(“;不是完成建议字段”;),elasticsearch,autocomplete,elasticsearch,Autocomplete" />

elasticsearch Elasticsearch-Can';t使用建议字段进行搜索(“;不是完成建议字段”;)

elasticsearch Elasticsearch-Can';t使用建议字段进行搜索(“;不是完成建议字段”;),elasticsearch,autocomplete,elasticsearch,Autocomplete,我是elasticsearch的新手,我正在尝试在一个名为“identity.full_name”、index=“search”和type=“person”的现有字段上使用elasticsearch completion suggester。 我按照下面的索引更改字段的映射 (一) (二) (三) 当我在这里检查映射时,使用 GET search/_mapping/person/field/identity.full_name 我得到了结果 { "search": { "mappi

我是elasticsearch的新手,我正在尝试在一个名为“identity.full_name”、index=“search”和type=“person”的现有字段上使用elasticsearch completion suggester。 我按照下面的索引更改字段的映射

(一)

(二)

(三)

当我在这里检查映射时,使用

GET search/_mapping/person/field/identity.full_name
我得到了结果

{
  "search": {
    "mappings": {
      "person": {
        "identity.full_name": {
          "full_name": "identity.full_name",
          "mapping": {
            "full_name": {
              "type": "text",
              "fields": {
                "completion": {
                  "type": "completion",
                  "analyzer": "simple",
                  "preserve_separators": true,
                  "preserve_position_increments": true,
                  "max_input_length": 50
                },
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                },
                "suggest": {
                  "type": "completion",
                  "analyzer": "simple",
                  "preserve_separators": true,
                  "preserve_position_increments": true,
                  "max_input_length": 50
                }
              }
            }
          }
        }
      }
    }
  }
}
这表明它已被更新为一个完成字段

但是,当我使用查询来检查这是否有效时

GET search/person/_search
{
    "suggest": {
        "person-suggest" : {
            "prefix" : "EMANNUEL",
            "completion" : {
                "field" : "identity.full_name"
            }
        }
    }
}
它给我的错误是“字段[identity.full_name]不是完成建议字段”

我不知道为什么会出现这个错误。还有什么我可以试试的吗

样本数据:

  {
    "_index": "search",
    "_type": "person",
    "_id": "3106105149",
    "_score": 1,
    "_source": {
      "identity": {
        "id": "3106105149",
        "first_name": "FLORENT",
        "last_name": "TEBOUL",
        "full_name": "FLORENT TEBOUL"
        }
        }
        }

  {
    "_index": "search",
    "_type": "person",
    "_id": "125296353",
    "_score": 1,
    "_source": {
      "identity": {
        "id": "125296353",
        "first_name": "CHRISTINA",
        "last_name": "BHAN",
        "full_name": "CHRISTINA K BHAN"
        }
        }
        }
所以当我做一个基于前缀“CHRISTINA”的GET时

获取搜索/个人/\u搜索

{
    "suggest": {
        "person-suggest" : {
            "prefix" : "CHRISTINA",
            "completion" : {
                "field" : "identity.full_name.suggest"  
                }
            }
        }
    }
我得到的所有结果都像一个匹配的查询。

你应该像这样使用它

GET search/person/_search

    {
        "suggest": {
            "person-suggest" : {
                "prefix" : "EMANNUEL",
                "completion" : {
                    "field" : "identity.full_name.suggest"
                }
            }
        }
    }
获取搜索/u映射/person/field/identity的映射。全名

{
  "search" : {
    "mappings" : {
      "person" : {
        "identity.full_name" : {
          "full_name" : "identity.full_name",
          "mapping" : {
            "full_name" : {
              "type" : "text",
              "fields" : {
                "suggest" : {
                  "type" : "completion",
                  "analyzer" : "simple",
                  "preserve_separators" : true,
                  "preserve_position_increments" : true,
                  "max_input_length" : 50
                }
              }
            }
          }
        }
      }
    }
  }
}
你应该像这样使用它

GET search/person/_search

    {
        "suggest": {
            "person-suggest" : {
                "prefix" : "EMANNUEL",
                "completion" : {
                    "field" : "identity.full_name.suggest"
                }
            }
        }
    }
获取搜索/u映射/person/field/identity的映射。全名

{
  "search" : {
    "mappings" : {
      "person" : {
        "identity.full_name" : {
          "full_name" : "identity.full_name",
          "mapping" : {
            "full_name" : {
              "type" : "text",
              "fields" : {
                "suggest" : {
                  "type" : "completion",
                  "analyzer" : "simple",
                  "preserve_separators" : true,
                  "preserve_position_increments" : true,
                  "max_input_length" : 50
                }
              }
            }
          }
        }
      }
    }
  }
}

这是为我返回所有记录。就像match_一样,我不知道为什么它对你不起作用。它完全适合我(我复制了上面的所有步骤)。如果有的话,你能提供其他详细信息或样本数据吗?我得到的是克里斯蒂娜·K·班的结果,只是为了你添加的搜索查询,而不是弗洛伦特·特布尔的搜索结果。你能把你的领域地图发给我吗?使用
GET-search/\u-mapping/person/field/identity.full\u-name
在使用GET-search而不使用索引和类型时获得结果。这将为我返回所有记录。就像match_一样,我不知道为什么它对你不起作用。它完全适合我(我复制了上面的所有步骤)。如果有的话,你能提供其他详细信息或样本数据吗?我得到的是克里斯蒂娜·K·班的结果,只是为了你添加的搜索查询,而不是弗洛伦特·特布尔的搜索结果。你能把你的领域地图发给我吗?使用
GET-search/\u-mapping/person/field/identity.full\u-name
在使用GET-search而不使用索引和类型时获得了结果。
{
  "search" : {
    "mappings" : {
      "person" : {
        "identity.full_name" : {
          "full_name" : "identity.full_name",
          "mapping" : {
            "full_name" : {
              "type" : "text",
              "fields" : {
                "suggest" : {
                  "type" : "completion",
                  "analyzer" : "simple",
                  "preserve_separators" : true,
                  "preserve_position_increments" : true,
                  "max_input_length" : 50
                }
              }
            }
          }
        }
      }
    }
  }
}