Completion Suggester ignores commas, dashes


(Alexander Roussakov) #1

Hey, I am quite confused
I want to reach the same effect as a google autocomplete does within it input field, when you start typing chars you get autocompletion in a grey colour, so i've chosen completion suggester to implement this behaviour.
It looks like it works fine but there is some issues with symbols like commas and dashes

"suggestions" : { "type" : "completion",
                  "index_analyzer" : "simple",
                  "search_analyzer" : "simple",
                  "payloads" : true
},

My suggest query:

{"test-suggest" : {
        "text" : "Brekke-",
        "completion" : {
            "field" : "suggestions",
            "size" : 10
        }
    }
}

result:

    {
  "_shards": {
    "total": 1,
    "successful": 1,
    "failed": 0
  },
  "test-suggest": [
    {
      "text": "Brekke-",
      "offset": 0,
      "length": 7,
      "options": [
        {
          "text": "Brekke Ltd",
          "score": 1
        },
        {
          "text": "Brekke-Hoppe",
          "score": 1
        },
        {
          "text": "Brekke, Metz and Lemke",
          "score": 1
        },
        {
          "text": "Brekke, Prosacco and Padberg",
          "score": 1
        }
      ]
    }
  ]
}

My documents stored in following structure:

  {
    "_index": "sobjects5",
    "_type": "account",
    "_id": "AU_aF5FHQ_fPVvioZbZs",
    "_score": 1,
    "_source": {
      "contactId": "deef3eec-9064-3dfa-a51f-357e491bb79f",
      "id": "e8eb437fe4af77edf438512bc9aee896",
      "accountType": "CUSTOMER",
      "companyName": "Collier-Jaskolski",
      "firstName": "Alejandra",
      "lastName": "Rolfson",
      "email": "Jonatan52@gmail.com",
      "suggestions": {
        "input": [
          "Laurel",
          "Wunsch",
          "Hills-Cronin",
          "Braun.Twila@Bartoletti.com"
        ]
      }
    }
  }

expected:
I don't want to get any results which not exactly match the suggest value.

Any suggestions, guys? :slight_smile:

Thanks!


(system) #2