vzhikserg commented on a change in pull request #6028: [Issue 5690][pulsar-io]
Make type name of Elasticsearch sink connector configurable.
URL: https://github.com/apache/pulsar/pull/6028#discussion_r365769483
##########
File path: site2/docs/io-elasticsearch-sink.md
##########
@@ -40,10 +45,95 @@ Before using the ElasticSearch sink connector, you need to
create a configuratio
```yaml
configs:
- elasticSearchUrl: "http://localhost:90902"
- indexName: "myIndex"
+ elasticSearchUrl: "http://localhost:9200"
+ indexName: "my_index"
username: "scooby"
password: "doobie"
```
+#### For Elasticsearch Before 6.2
+
+* JSON
+
+ ```json
+ {
+ "elasticSearchUrl": "http://localhost:9200",
+ "indexName": "my_index",
+ "typeName": "doc",
+ "username": "scooby",
+ "password": "doobie"
+ }
+ ```
+
+* YAML
+
+ ```yaml
+ configs:
+ elasticSearchUrl: "http://localhost:9200"
+ indexName: "my_index"
+ typeName: "doc"
+ username: "scooby"
+ password: "doobie"
+ ```
+
+### Usage
+
+1. Start a single node Elasticsearch cluster.
+
+ ```bash
+ $ docker run -p 9200:9200 -p 9300:9300 \
+ -e "discovery.type=single-node" \
+ docker.elastic.co/elasticsearch/elasticsearch:7.5.1
+ ```
+
+2. Start a Pulsar service locally in standalone mode.
+ ```bash
+ $ bin/pulsar standalone
+ ```
+ Make sure the nar file is available at
`connectors/pulsar-io-elastic-search-{{pulsar:version}}.nar`.
+
+3. Start the Pulsar Elasticsearch connector in local run mode using one of the
following methods.
+ * Use the **JSON** configuration as shown previously.
+ ```bash
+ $ bin/pulsar-admin sinks localrun \
+ --archive
connectors/pulsar-io-elastic-search-{{pulsar:version}}.nar \
+ --tenant public \
+ --namespace default \
+ --name elasticsearch-test-sink \
+ --sink-type elastic_search \
+ --sink-config
'{"elasticSearchUrl":"http://localhost:9200","indexName":
"my_index","username": "scooby","password": "doobie"}' \
+ --inputs elasticsearch_test
+ ```
+ * Use the **YAML** configuration file as shown previously.
+
+ ```bash
+ $ bin/pulsar-admin sinks localrun \
+ --archive
connectors/pulsar-io-elastic-search-{{pulsar:version}}.nar \
+ --tenant public \
+ --namespace default \
+ --name elasticsearch-test-sink \
+ --sink-type elastic_search \
+ --sink-config-file elasticsearch-sink.yml \
+ --inputs elasticsearch_test
+ ```
+
+4. Publish records to the topic.
+
+ ```bash
+ $ bin/pulsar-client produce elasticsearch_test --messages "{\"a\":1}"
+ ```
+5. Check documents in Elasticsearch.
+
+ * refresh the index
+ ```bash
+ $ curl -s http://localhost:9200/my_index/_refresh
+ ```
+ * search documents
+ ```bash
+ $ curl -s http://localhost:9200/my_index/_search
+ ```
+ You can see the record that published earlier has been successfully
written into Elasticsearch.
+ ```bash
Review comment:
```suggestion
```json
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services