I have a JSON object in Postgres and I need to dynamically identify values with one or more partial matches. For example, a sample JSON object will look something like this:
{"field1":"abcdef","field2":"defghi","field3":"jklmno"}
I do not know the search parameters until run-time, but I do know that they are all partial matches. For example, I could get as a search criteria: {“field1″:”abc”,”field3″:”mno”}
I considered using something like this as criteria:
where data @? '$.field1 ? (@ like_regex ".*abc.*")'
However, I do not know how to enable multiple search criteria. Also, the search criteria is expected to be an AND operation, not an OR. All search criteria must be met for the object to be selected.
Any help is appreciated!