Search code examples
elasticsearchsearch-suggestion

Elastic completion suggester creating inputs


I have more than 200 000 records so I need to automatically create inputs for complete suggester.

I need to get results also for incorrect order ("Potter Harry" instead of "Harry Potter").

Mapping for suggestion:

"title_suggest": 
{
   "type": "completion"
}

Indexing:

{
    "title" : {$title},
    "title_suggest" : 
     {
        "input" : {...},
        "output": {$title}
     }
}

Examples:

The simple one: "Harry Potter" has input {"Harry Potter", "Potter Harry"}.

But how to create input for long titles? Eg. "Diary of a modern couple or women are from Venus and men are a moron"? It makes 1 307 674 368 000 variants of words order.

I hope it is clear what I need.


Solution

  • I changed the suggester. I'm not using Completion Suggester. I'm using ngrams from here: https://stackoverflow.com/a/29754468/1564987