CREATE TABLE chat ( id uuid NOT NULL, pub_time timestamp NOT NULL, content jsonb NOT NULL ); CREATE INDEX chat_time_idx ON chat (pub_time); CREATE INDEX chat_message_idx ON chat USING GIN (to_tsvector('english', content->'params'->>1));