0

我创建了以下映射:

PUT /test/userfolder/_mapping -d '{
      "userfolder": {
        "properties": {
          "suggest_folder": {
            "type": "completion",
            "analyzer": "simple",
            "payloads": false,
            "preserve_separators": true,
            "preserve_position_increments": true,
            "max_input_length": 50,
            "context": {
              "user": {
                "type": "category",
                "path": "userID",
                "default": []
              }
            }
          },
          "userID": {
            "type": "long"
          },
          "id": {
            "type" : "long"
          }
        }
      }
   }'

并添加了以下内容:

PUT /test/userfolder/1 -d '{
  "suggest_folder" : {
    "input" : [ "travel" ]
  },
  "userID" : 14
}'

并查询我使用以下内容:

POST /test/_suggest -d '{
    "suggest" : {
        "text" : "tra",
        "completion" : {
            "field" : "suggest_folder",
            "size": 10,
            "context": {
                "user": 14
            }
        }
    }
}'

但是,即使我们插入了带有价值旅行和用户 ID 的文档,我也没有任何选择。我究竟做错了什么?

4

0 回答 0