Reputation: 1340
I'm using elastic search 5.3 and to provide did-you-mean functionality, I want to limit the context of term or phrase suggester to only user's documents not all the documents in the index. here's my current _search
query body using term suggester (which returns suggestion based on all indexed documents):
{
"suggest": {
"text": "docyment",
"title_correction: {
"term": {
"size": 2,
"prefix_length": 3,
"field": "title",
"analyzer": "standard",
"min_doc_freq": 1,
}
}
}
}
I can see that filtering was part of phrase_suggester
in the past (check this issue) but it seems that it has been deprecated and replaced by context suggester (only for completion fields though), so it's not suitable for my case.
What I need is to have a filter like: "filter": {"term": {"user_id": 12345}}
so suggestions will be based on user's documents.
I would appreciate it if anyone could come up with answers to my questions :
0- Why the filter has been deprecated from phrase suggester? only to boost up performance?
1- If it has been replaced by something else and there's recommended way to do it, so I can solve my issue?
(I've asked same question in elastic forum, and will update both of these questions in case I find the answer)
Upvotes: 4
Views: 1685
Reputation: 1
I have the same need basically, there is the prune query which should allow to rule out the documents you don't want: have a look at How do I add a weight (or prefilter) for a phrase suggester?
Upvotes: 0