Since switching search engine to ElasticSearch 7.9.1 (necessary for Magento 2.4.0) my site has only been able to search the catalog with a single word. When two or more are entered the front end reports "no products found" but in the exception log is this clue:
field:[sku] was indexed without position data; cannot run PhraseQuery
The message comes from Elasticsearch which I know nothing about but this page gives me hope that it can be fixed. The confusing part is that SKU field is not supposed to be searchable. Also I cannot imagine this would be a pre-existing bug that got by Magento's devs unnoticed.
So what is the solution? How can the search schema be corrected or can SKU be excluded from search altogether? I would prefer the latter as the schema is probably rebuilt on a full reindex and that would reset any fix.
Update We found a workaround by setting SKU attribute to be searchable and then running:
bin/magento indexer:reindex catalogsearch_fulltext
This isn't ideal as SKU wasn't intended to be exposed to customers.