So, there are several things to consider here.
First, I'm unfamiliar with the "patch for autocompletion" in Beego, so I have no idea how that affects or may be related to this.
Second, I see from the memory profile that you are using zap v11. This is the default in Bleve v1.x for backwards compatibility reasons, but v11 has known problems. Specifically, it increasingly wastes space as the segment files get larger (the opposite of what should happen). Zap v15 is still the latest version, and it was supported in v1.x, however if are going to upgrade, I recommend considering a full upgrade to bleve 2.x as community support only really covers the latest version. This may not fix or even help your issue at all, but generally smaller indexes on disk will take less memory to search at query time.
Next, was this profile taken on a production system with multiple queries active? Or was this taken with just a single query running. The memory usage would appear to be excessive if this is just a single query, but could be quite normal if it represents multiple queries in aggregate.
You asked if there is a "way to more properly manage the memory consumption". There are a few things, some related to memory used while indexing, and some while searching. I'll only go into the ones at query time based on the context of your question. We offer two callback functions which can be set, one which fires before a query starts and one that fires after.
Both functions take one argument, an estimate of the memory required to complete this search in bytes. This estimate is often not very good, but it is something. If the first function returns an error, we abort execution of the search and return the error you gave us. You can use these functions to track how much memory is used by active searches, and being rejecting queries when it has gotten too high. Again, because the estimates are not great, the usage you track will not be accurate, but it will give you some idea and you can try to dial in to an acceptable level.
But, at the end of the day, all this is doing is rejecting queries, and nobody really wants to do that, unless the index is replicated and you can offload query workload to other servers. So, you really want to get into what types of queries are you executing, and is there anything you can change to make them require less memory. Things like large values for size (to return all matches) or computing large facets/aggregations all contribute to using a lot of memory.
Finally, you mentioned you can only share the code in private. Reviewing code in private is a service I make available to my sponsors, usually with some additional hourly contract work set up. Reach out to me directly if you're interested.
marty