What does HackerNews think of zombodb?

Making Postgres and Elasticsearch work together like it's 2022

Language: PLpgSQL

#1 in PostgreSQL
#1 in PostgreSQL
#1 in SQL
Do you two know about ZomboDB (https://github.com/zombodb/zombodb)?

Quite deep Postgres/Elasticsearch integration

> The hardest part of building any search engine is keeping the index up-to-date with changes made to the underlying data store.

This deserves mention, as it solves that problem: https://github.com/zombodb/zombodb

From the README:

> ZomboDB brings powerful text-search and analytics features to Postgres by using Elasticsearch as an index type. Its comprehensive query language and SQL functions enable new and creative ways to query your relational data.

> From a technical perspective, ZomboDB is a 100% native Postgres extension that implements Postgres' Index Access Method API. As a native Postgres index type, ZomboDB allows you to CREATE INDEX ... USING zombodb on your existing Postgres tables. At that point, ZomboDB takes over and fully manages the remote Elasticsearch index and guarantees transactionally-correct text-search query results.

I find other things also hard in search engines: dealing with the plethora of human languages and all the requirements we may have to processing them. A mature solution like ES therefor is almost a must in the more demanding cases.

Among other things in that earlier thread, there's some discussion of aspects of ZomboDB with its developer.

ZomboDB is a Postgres extension that enables efficient full-text searching via the use of indexes backed by Elasticsearch. (From the project's website[0]).

Lots more info in readme at the project's github[1].

[0] http://zombodb.com

[1] https://github.com/zombodb/zombodb

ElasticSearch has "dense_vector" datatype and vector-specific functions.

  https://www.elastic.co/guide/en/elasticsearch/reference/current/dense-vector.html
  https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-script-score-query.html#vector-functions
ZomboDB integrates ElasticSearch as a PG extension, written in Rust:

  https://github.com/zombodb/zombodb
I dunno what exactly a "dense_vector" is, but if you can't use the native "tsvector" maybe you could use this?
If your search needs outgrow Postgres' native search engine, you can use Postgres search with an ElasticSearch backend, using Zombo

https://github.com/zombodb/zombodb

It basically gives you a new kind of index (create index .. using zombodb(..) ..)

Do you see any particular reasons to use or not use ZomboDB [1]? It claims to lets you use ElasticSearch from PG seamlessly e.g. it manages coherency of which results ought to be returned according to the current transaction. (I've never quite ended up needing to use ES but it's always seemed to me I'd be likely to need ZomboDB if I did.)

[1] https://github.com/zombodb/zombodb

TBH I hadn't known you could do weighted ranking with Postgres search before.

Curious there's no mention of zombodb[0] though, which gives you the full power of elasticsearch from within postgres (with consistency no, less!). You have to be willing to tolerate slow writes, of course, so using postgres' built-in search functionality still makes sense for a lot of cases.

[0] https://github.com/zombodb/zombodb

Did you look at ZomboDB? It allows you to use Elasticsearch as a native Postgres index type.

https://github.com/zombodb/zombodb

Never tried it out (it's on my never-getting-done list), but someone has built it: https://github.com/zombodb/zombodb
Thanks for the detailed response. I'm curious, is the NoSQL store a canonical store of its own data? If not, how do you replicate from postgres to the secondary store?

I ask because where I work we sync postgres to a secondary store for search, but the way it's done in a piecemeal, application-specific way gives me the heebie jeebies. It almost certainly will result in that secondary store drifting. Unfortunately we can't use something like zombodb [1] as we're on amazon RDS. It seems like you know your stuff, and seeing non-deterministic consistency irritates the heck out of me!

[1] https://github.com/zombodb/zombodb

Author of `pgx` here.

We developed pgx so that we could rewrite "ZomboDB" (https://github.com/zombodb/zombodb) in Rust. ZDB is a custom "Index Access Method" for Postgres. Think btree index, but stored in Elasticsearch.

So that's definitely a thing.

Other ideas might be custom data analytics/transformation/processing engines that you'd prefer to run in the database instead of externally.

Custom data types to represent, for example, street addresses or genetic information.

The only limit is yourself! ;)

FYI, you might want to check out ZomboDB[0], which integrates Postgres and ElasticSearch. It's open source[1] and, fwiw, the developer was helpful when I pinged him with some questions a while back (and is available for consulting services).

From the project's github page[1]:

ZomboDB brings powerful text-search and analytics features to Postgres by using Elasticsearch as an index type. Its comprehensive query language and SQL functions enable new and creative ways to query your relational data.

From a technical perspective, ZomboDB is a 100% native Postgres extension that implements Postgres' Index Access Method API. As a native Postgres index type, ZomboDB allows you to CREATE INDEX ... USING zombodb on your existing Postgres tables. At that point, ZomboDB takes over and fully manages the remote Elasticsearch index and guarantees transactionally-correct text-search query results.

[0] https://www.zombodb.com/

[1] https://github.com/zombodb/zombodb

https://github.com/zombodb/zombodb works for me by turning Elasticsearch into an index type (PG10 only)
I can't speak for MySQL, as I haven't used it in a while, but I'd pick a properly configured Postgres full text over ES in a heart beat, if only because it means one less dependency (tree) to worry about. (As a bonus, the beauty of Postgres allows to use ES as an index type if you so wish [0].)

Also:

> Squeezing the query language into some sql-like shape will provide marginal gain at best.

... is disingenuous at best. In both examples I raised (and in the ones you'll find if you query the others) the engines have functionality to accept user input pretty much as is - meaning as your typical mom would type it in a search field.

If you need extra criteria from there and the dialect's full text syntactic features, you can use regular SQL conditions (and joins, and aggregates, etc.) on the subset of records found. The most discriminating criteria/index will be the one related to the search query in most cases. And when not, lucky you - your query planner did not hammer everything with the same sledgehammer, thus demonstrating why you should be using SQL.

[0]: https://github.com/zombodb/zombodb

It's not native support but more than a couple times I have wondered how well this works: https://github.com/zombodb/zombodb

Doesn't seem to be a whole lot of people trying it out, though the project is 'relatively' active.

You might want to look at https://github.com/zombodb/zombodb. It extends PG to use ES as an external source for indexes. So you can do an ES based text search and return a data stored in PG along with doing joins to other tables. Zombo even works with Citus to handle PG level sharding.
For many the source of truth is still Postgres, but you may want some of the flexibility and search power that comes along with ElasticSearch in many cases. An interesting project to look at may be ZomboDB which lets you maintain ElasticSearch indexes from directly within Postgres and query from within PG directly. (https://github.com/zombodb/zombodb)
Someone here mentioned ZomboDB[1]. Would that help you?

[1] https://github.com/zombodb/zombodb

Does anyone have experience with ZomboDB?

"ZomboDB is a Postgres extension that enables efficient full-text searching via the use of indexes backed by Elasticsearch. In order to achieve this, ZomboDB implements Postgres' Access Method API.

In practical terms, a ZomboDB index appears to Postgres as no different than a standard btree index. As such, standard SQL commands are fully supported, including SELECT, BEGIN, COMMIT, ABORT, INSERT, UPDATE, DELETE, COPY, and VACUUM."

https://github.com/zombodb/zombodb