Knowledge Management articles search is slow
Knowledge Management articles Search takes more than 40 seconds to return results.
Steps to Reproduce
- Log in with the end user portal access group similar to the out-of-the-box ExternalKMUserAG access group.
- Display the default or basic articles of each category.
- Search for the articles.
- Open the required article.
The problem is in the performance of executing queries by the Elastic Search. Executing a query with a single word is faster, but is still considered slow (about 20 seconds). This is due to how the query is constructed. According to the logs, the platform always executes queries in the CONTAINS mode which adds wildcards around a word, such as, DNS, Out, or Opt.
The workaround for this is to use quotation marks such as, "DNS" when the client is referring to it as the mode EXACT.
According to the Elastic Search documentation, using Wildcards in queries is expensive and must be avoided if possible. However, queries without a '*' are fast, and this is what Elastic Search is designed for.
Perform the following local-change:
Use quotation marks to perform an exact search for each work,
"DNS" "Opt" "Out" (This is fast. All the documents containing the three words DNS, Opt and Out are searched.)
"DNS" "Opt" Out (This is slow. All the documents containing the words, DNS and Opt and also a word which contains a substring Out are searched.)
Change the CONTAINS type in the Search activity to EXACT.
Now, the quotation marks are not required. However, CONTAINS can be enforced to be used.
The two earlier example queries can be rewritten as:
DNS Opt Out
DNS Opt Out
Additionally, the client can also include queries such as, Out* or *Out