0

I have created the following mapping:

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"
          }
        }
      }
   }'

And added the following:

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

And to query I use the following:

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

But I don't get any options even though we have inserted a document with value travel and a userID. What am I doing wrong?

labyrinth
  • 1,104
  • 3
  • 11
  • 32

0 Answers0