We have a requirement to build a UI in a search interface to show "Recent searches of yours", "Frequent searches of yours" and "Popular searches from other users" each being a list of suggested search queries. Although I'm aware the index has statistics of queries, I haven't seen anything about how to read this data for this given purpose. Knowing that the statistics are all there makes me reluctant to go build my own approach at this.
I believe this is a similar question to Find, tracking and get the statistics | Optimizely Developer Comm which concluded that it was a feature request - does anyone know if this feature request was added in v13.4.8 or if it will/has been added to a newer version?
Otherwise, has anyone come up with a nice solution to this? Or have alternative suggestions? FYI this is a Commerce website if that affects the approach.
Thanks for any advice,
As that post has suggested call are made to the proxying code /EPiServer/Find/proxy/_stats/ endpoint which in turns just forwards those queries directly to the Search & Navigation instance which is just an elastic wrapper. Therefore those queries end up being translated to something like https://emea01.find.episerver.net/KEY/INDEX/_stats/ therefore it's totally possible even tho there's not .NET types and methods to handle every part of the stats area to just make direct calls and wrap them up in your own. The stats APIs follow https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-stats.html
I just tried pulling fielddata out of one of my live indexes and it worked fine such as https://emea01.find.episerver.net/KEY/INDEX/_stats/fielddata
If you are calling from the front end however you should be able to just make your calls to /EPiServer/Find/proxy/_stats/ which will handle the translation of the proxy query to the elastic index and make those queries anyhow. Either direct or through the proxy so you don't need to load the key and index but you can they retrieve stats via the service or URL direct
Thanks Scott, I'll have a play with the direct HTTP calls and see what we can get from that.
Still keen to hear if anyone with experience of using search suggestions based on queries - did you implement moderation? Did you have a process to check that queries actually get results?