Closed ogierpaul closed 3 years ago
Thanks for raising this issue. I'm thinking that if the query column has a json type then it will only accept json queries, otherwise if it has a text type it will accept lucene uri queries. Does that sound like a reasonable way to add this functionality?
It seems reasonnable. This is what I have tried to do. I updated my question to clarify what are the expected results.
So the column cannot be json because there is no operator for performing json comparisons:
ERROR: operator does not exist: json = json
LINE 1: select '1'::json = '1'::json;
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
The query column works by populating the column with the value of the query so that when the rows are checked by postgres after being returned they are retained. I have an idea for how to fix this, but it will involve passing the query as a string.
Created https://github.com/matthewfranglen/postgres-elasticsearch-fdw/pull/20 to address this issue. Could you review it and see if it works for you?
Confirmed fixed by @ogierpaul in PR
Good morning, I would like to query ElasticSearch using a query body defined in Postgres. I am not able to pass the query body as a JSON using the query parameter.
Architecture Framework
Elastic Search index
I have one index containing all my data in ElasticSearch target-index With the mapping:
Postgres Data
See the example of the JSON query for row 1: It's a multi-match query
Foreign Data Wrapper
Results. actual vs Expected:
Query using:
Expected result
Actual result
ERROR: operator does not exist: json = json
I cannot pass a query parameter as json