Tech:CirrusSearch
Benefits
- Matching different variants of the same word. For example, searching for “communities” will match pages containing the word “community” and vice-versa. Same goes for verbs such as “create” and “created”.
- Case insensitive search suggestions (can also be done with TitleKey).
- Searching pages with advanced directives such as
intitle,insource, andincategory.
Troubleshooting
illegal_argument_exception: no mapping found for field [suggest]
This was seen in T13277 and T13334 when checking Greylog for a failed search request. This error is related to #Primary index was expected to be an alias, and it can be fixed by fixing that as well.
Primary index was expected to be an alias
This was first seen in T13334 when running CirrusSearch:UpdateSearchIndexConfig on a wiki exhibiting “illegal_argument_exception: no mapping found for field [suggest]”. Unfortunately, it is not yet known what causes this. For now, this can be worked around by manually deleting the wiki’s indices:
$ curl -X DELETE https://opensearch-mw.wikitide.net/testwiki_{content,general}The output should be {"acknowledged":true}{"acknowledged":true}.
Afterwards, rebuild the search index from scratch. This would normally incur downtime for searching, but considering that searching is already broken, this doesn’t really matter. Instructions (copied from CirrusSearch README):
$ mwscript CirrusSearch:UpdateSearchIndexConfig testwiki --startOver
$ mwscript CirrusSearch:ForceSearchIndex testwikiThis problem was twice recorded to have happened ever since CirrusSearch was enabled on the wiki:
- T13277#266442
- https://wm-bot.wmcloud.org/logs/%23miraheze/20250728.txt#:~:text=%5B23:46:01%5D,now%20fixed
Here’s a python script to give the appropriate commands:
#!/usr/bin/python3
import sys
wiki = sys.argv[1]
task = ''
if sys.argv.__len__() > 2:
task = '--task=' + sys.argv[2]
command = []
command.append("curl -X DELETE https://opensearch-mw.wikitide.net/%s_{content,general}" % wiki)
command.append("logsalmsg curl -X DELETE https://opensearch-mw.wikitide.net/%s_{content,general}" % wiki)
command.append(f"mwscript CirrusSearch:UpdateSearchIndexConfig {wiki} --startOver {task}")
command.append(f"mwscript CirrusSearch:ForceSearchIndex {wiki} {task}")
print('\n'.join(command))