pathway.io.elasticsearch package


pathway.io.elasticsearch.write(table, host, auth, index_name)

Write a table to a given index in ElasticSearch.

  • Parameters
    • table (Table) – the table to output.
    • host (str) – the host and port, on which Elasticsearch server works.
    • auth (ElasticSearchAuth) – credentials for Elasticsearch authorization.
    • index_name (str) – name of the index, which gets the docs.
  • Returns
    None

Example:

Consider there is an instance of Elasticsearch, running locally on a port 9200. There we have an index “animals”, containing an information about pets and their owners.

For the sake of simplicity we will also consider that the cluster has a simple username-password authentication having both username and password equal to “admin”.

Now suppose we want to send a Pathway table pets to this local instance of Elasticsearch.

It can be done as follows:

import pathway as pw
t = pw.elasticsearch.write(
table=pets,
host="http://localhost:9200",
auth=pw.elasticsearch.ElasticSearchAuth.basic("admin", "admin"),
index_name="animals",
)

All the updates of table t will be indexed to “animals” as well.