# Hugo + self-hosted Search (Elastic or similar) Integration - tips?

**URL:** https://discourse.gohugo.io/t/hugo-self-hosted-search-elastic-or-similar-integration-tips/45153
**Category:** tips & tricks
**Tags:** search
**Created:** [July 5, 2023, 12:19pm UTC](https://discourse.gohugo.io/t/hugo-self-hosted-search-elastic-or-similar-integration-tips/45153 "2023-07-05T12:19:09Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![marshalc](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/marshalc/32/17434_2.png) [@marshalc](https://discourse.gohugo.io/u/marshalc)
#### Post date: [July 5, 2023, 12:19pm UTC](https://discourse.gohugo.io/t/hugo-self-hosted-search-elastic-or-similar-integration-tips/45153/1 "2023-07-05T12:19:09Z")

</div>

I’m not certain where the boundaries of this challenge lie (Hugo feature? Theme feature? Custom development?), so this is more of a request for help and pointers on the topic as my searching for prior examples hasn’t delivered anything suitable for me yet.

I’ve got a couple of “large” Hugo sites for internal to the workplace access. Both contain either personal or sensitive data, and thus are not internet accessible. By large - one build is currently ~60k pages, and the other (in development - because it is very hard to build!) is about 1.5million pages. They’re both based on Hugo + Docsy (a setup we have running well on our Gitlab Pages system).

Free text searching of all content is a _must have_ feature for these sites, so fixing search is a bit of a priority for me presently.

My initial concern is that for the 60k site, the `offline-search-index.nnnnn.json` file is ~850MB at present, and that’s causing slow browser page load times - and therefore that a dedicated, not-in-browser-memory-JS-based search platform would help.

My second goal is that we have multiple Hugo+Docsy builds on a range of projects on the Gitlab system, and I’d like an option to search across them all - so a single search index.

We have an Elastic Search cluster setup for another project internally, which would seem like an ideal platform to try and utilise for these two goals since we can’t use an off-site search-as-a-service platform such as Algolia.

Therefore I have essentially two requests here:

1. Sanity check - am I correct in needing to look at a self-hosted search platform?
2. If so, then what is recommended, and are there any guides you can point me at to help please?

I’ll note that I had seen a Bonsai SaaS guide previously (that’s currently 404-ing), and I’ve seen a 5 year old NPM module for Hugo+ElasticSearch, but that last one doesn’t seem to be complete or relevant.

Thanks in advance!

---

<div class="post-metadata">

### Author: ![bwintx](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bwintx/32/10450_2.png) [@bwintx](https://discourse.gohugo.io/u/bwintx)
#### Post date: [July 5, 2023, 1:18pm UTC](https://discourse.gohugo.io/t/hugo-self-hosted-search-elastic-or-similar-integration-tips/45153/2 "2023-07-05T13:18:57Z")

</div>

As always, I highly recommend Pagefind.

> **[Pagefind | Pagefind](https://pagefind.app)**
>
> Pagefind is a fully static search library that aims to perform well on large sites, while using as little of your users’ bandwidth as possible, and without hosting any infrastructure.

---

<div class="post-metadata">

### Author: ![McShelby](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/mcshelby/32/15112_2.png) [@McShelby](https://discourse.gohugo.io/u/McShelby)
#### Post date: [July 5, 2023, 6:44pm UTC](https://discourse.gohugo.io/t/hugo-self-hosted-search-elastic-or-similar-integration-tips/45153/3 "2023-07-05T18:44:05Z")

</div>

Pagefind sounds really promising. The only thing that bugs me is the missing integration with `hugo serve` as far as I understood.

Did you solve this or do I have a wrong understanding?

---

<div class="post-metadata">

### Author: ![bwintx](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bwintx/32/10450_2.png) [@bwintx](https://discourse.gohugo.io/u/bwintx)
#### Post date: [July 5, 2023, 6:46pm UTC](https://discourse.gohugo.io/t/hugo-self-hosted-search-elastic-or-similar-integration-tips/45153/4 "2023-07-05T18:46:40Z")

</div>

I didn’t, but Régis Philibert did (see the [2022-07-31 update](https://www.brycewray.com/posts/2022/07/pagefind-quite-find-site-search/#update-2022-07-31) therein):

> **[Pagefind is quite a find for site search | BryceWray.com](https://www.brycewray.com/posts/2022/07/pagefind-quite-find-site-search/)**
>
> It used to be that having search on a static site was a hassle — and perhaps an expensive one — but Pagefind has changed all that.

---

<div class="post-metadata">

### Author: ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)
#### Post date: [July 5, 2023, 8:00pm UTC](https://discourse.gohugo.io/t/hugo-self-hosted-search-elastic-or-similar-integration-tips/45153/5 "2023-07-05T20:00:46Z")

</div>

It’s some time since I looked into this, but for self-hosting I would look at Bleve:

[https://blevesearch.com/](https://blevesearch.com/)

Their site seems to be partly down (which is not great PR for Hugo since it’s built with … Hugo).

---

<div class="post-metadata">

### Author: ![Georg](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/georg/32/21486_2.png) [@Georg](https://discourse.gohugo.io/u/Georg)
#### Post date: [July 6, 2023, 9:20am UTC](https://discourse.gohugo.io/t/hugo-self-hosted-search-elastic-or-similar-integration-tips/45153/6 "2023-07-06T09:20:18Z")

</div>

Hi, just posted a simple tip as a new topic on how to use the Hugo server in local development with Pagefind.

---

<div class="post-metadata">

### Author: ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)
#### Post date: [August 31, 2023, 11:45pm UTC](https://discourse.gohugo.io/t/hugo-self-hosted-search-elastic-or-similar-integration-tips/45153/7 "2023-08-31T23:45:14Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
