Skip to content

Commit

Permalink
Fix readme examples
Browse files Browse the repository at this point in the history
  • Loading branch information
janheinrichmerker committed Jul 3, 2024
1 parent 6d93f75 commit 4e14766
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ from ray_elasticsearch import ElasticsearchDatasource

init()
source = ElasticsearchDslDatasource(index="test")
res = read_datasource(source).sum("foo")
res = read_datasource(source)\
.map(lambda x: x["_source"])\
.sum("id")
print(f"Read complete. Sum: {res}")
```

Expand Down Expand Up @@ -72,7 +74,9 @@ from ray_elasticsearch import ElasticsearchDatasink

init()
sink = ElasticsearchDatasink(index="test")
range(10_000).write_datasink(sink)
range(10_000)\
.map(lambda x: {"_source": x})\
.write_datasink(sink)
print("Write complete.")
```

Expand Down

0 comments on commit 4e14766

Please sign in to comment.