matthewfranglen / postgres-elasticsearch-fdw

Postgres to Elastic Search Foreign Data Wrapper
MIT License
108 stars 32 forks source link

Could a timeout option be provided for es ? #4

Closed iamoyjj closed 4 years ago

iamoyjj commented 4 years ago
        self.client = Elasticsearch(
            [
                {
                    "host": options.get("host", "localhost"),
                    "port": int(options.get("port", "9200")),
                }
            ],timeout=int(options.get("timeout", "10"))
        )
matthewfranglen commented 4 years ago

Thanks for opening this ticket. I'll look into it tonight.

matthewfranglen commented 4 years ago

I have added this option. You can use it like this:

CREATE FOREIGN TABLE articles_es
    (
        id BIGINT,
        title TEXT,
        body TEXT,
        query TEXT,
        score NUMERIC
    )
SERVER multicorn_es
OPTIONS
    (
        host 'elasticsearch',
        port '9200',
        index 'article-index',
        type 'article',
        rowid_column 'id',
        query_column 'query',
        score_column 'score',
        timeout '20'
    )
;

It is optional and defaults to 10 seconds. If you have any problems with it please raise another ticket.

matthewfranglen commented 4 years ago

I've released version 0.6.0 which includes this change.