snippetsqlMajor
How can I use a full-text search on a jsonb column with Postgres?
Viewed 0 times
canfullsearchcolumnwithpostgrestexthowusejsonb
Problem
So i have a
Is there any way to implement a full-text search on the entire jsonb column?
jsonb column that has entries like this: https://pastebin.com/LxJ8rKk4Is there any way to implement a full-text search on the entire jsonb column?
Solution
PostgreSQL 10+
PostgreSQL 10 introduces Full Text Search on JSONB
The new FTS indexing on JSON works with phrase search and skips over both the JSON-markup and keys.
PostgreSQL 10 introduces Full Text Search on JSONB
CREATE INDEX ON table
USING gin ( to_tsvector('english',jsondata) );The new FTS indexing on JSON works with phrase search and skips over both the JSON-markup and keys.
Code Snippets
CREATE INDEX ON table
USING gin ( to_tsvector('english',jsondata) );Context
StackExchange Database Administrators Q#179598, answer score: 24
Revisions (0)
No revisions yet.