Description
According to synonym
filter comment:
/*
* synonym and synonym_graph are different than everything else since they need access to the tokenizer factories for the index.
* instead of building the infrastructure for plugins we rather make it a real exception to not pollute the general interface and
* hide internal data-structures as much as possible.
*/
Because of this limitation, if you try to use it like the following (which is a valid syntax since the Analyze API docs mentions it but with stop
filter instead):
GET _analyze
{
"tokenizer": "standard",
"filter": [{
"type": "synonym",
"synonyms": ["test,testing"]
}],
"text": "this is a test"
}
You will get the following error: failed to find global token filter under [synonym]
This is misleading since it is the same error that you get if you use an unknown token filter name and, for newbies, specially the ones that just learned about the Analyze API, it can be confusing since synonym
should be a valid token filter name and the docs does not mentions this particular limitation of synonym
token filter.
Moreover, IMO synonym
should be supported by /_analyze
API anyway, if possible. Since it only works in the context of an index, the need to create a new test index every time you change the synonym configuration can be a time consuming task compared to simply using the /_analyze
API.