22

where do I find a howto to set up elasticSearch using Postgres?

My field sizes will be about 350mb, yes, MB, each in size. I have a text output of all of the US Code and all decisions from all the courts, the Statutes at Large, pretty much everything you would find in a library, and I need to be able to do full text searches and return the exact point in the field to the app to return the exact page in PDF form. Postgres can easily handle the datastore, but I've never used elasticSearch and have no idea of how it integrates into the indexing, etc.

1
  • 1
    Does it have to be elastic search? postgres s full text search wont work for you? Commented Mar 1, 2020 at 10:47

4 Answers 4

24

As of 2015, there's ZomboDB (https://github.com/zombodb/zombodb). As the author, I'm a bit biased, but it's quite powerful. ;)

It's a Postgres extension and Elasticsearch plugin that allows you to "CREATE INDEX"s that use a remote Elasticsearch cluster, and it exposes a fairly powerful query language for performing full-text searches.

Because it's an actual index in Postgres, the ES cluster is automatically synchronized as you INSERT/UPDATE/DELETE records. As such, there's no need for asynchronous synchronization processes.

Additionally, because it's an actual index, it is transaction-safe, which means concurrent Postgres sessions will only see results that are consistent with their current transaction.

Here's a link to ZomboDB's tutorial. It should give you an idea of how easy ZomboDB is to use.

Sign up to request clarification or add additional context in comments.

4 Comments

how to bulk import from postgres to elasticsearch on windows using zombodb
Sorry, I don't monitor StackOverflow. ZomboDB doesn't support Windows. Pull Requests are welcome at github.com/zombodb/zombodb
What about only bringing in records based on rules to a single elasticsearch index / repository? At work we're doing this with Rails and it's AWFUL (30 minutes to index) even using preload (set based ops). Problem is that it's two Postgres logical databases which cannot be joined (something something shared nothing bull-crap).
@EricB.Ridge can I use postgresql adater for EF Core with ZomboDB, or I should write all sql manuallly?
4

There is an application that you can use to import SQL Server, Oracle, Postgresql MySQL, etc. in to an ElasticSearch index.

http://code.google.com/p/ogr2elasticsearch/

Please let me know if you have any trouble building or using it. ~Adam

Comments

1

You can explore using pgsync.

PGSync is an open-source middleware (written in python) for syncing data from Postgres to Elasticsearch effortlessly. It allows you to keep Postgres as your source of truth and expose structured denormalized documents in Elasticsearch.

Githib link: https://github.com/toluaina/pgsync

Comments

0

Its possible to insert/update/delete postgres data in elasticsearch without middle ware other than the pgsql_http extension. Using triggers you can get a pretty much real-time index update.

You can also query elasticsearch and use the results within postgres to do joins etc with other tables/data in your database.

See the elasticsearch examples: https://github.com/sysadminmike/pgsql-http_examples

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.