DbSchema is a powerful database management and design tool for Elasticsearch. It offers features such as visual schema design, team collaboration with GIT, schema deployment and HTML schema documentation.
Choose "Connect to the database" or "New Model Connected to the Database" will let you select your database and open the Connection Dialog.
DbSchema automatically downloads the JDBC driver to connect to your database.
In the Connection Dialog window, select the JDBC URL you want to connect with. If your database is running in the cloud, choose Edit Manually and insert the JDBC URL from the cloud console.
Enter the host name, the authentication details, select your database as described in the Connection Dialog page.
Connecting to Elasticsearch may require to import first the Server HTTPS certificate into the Java carcerts file. During our tests we runned Elasticsearch in a docker container called elasticsearch created using:
docker run --name elasticsearch -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" -it docker.elastic.co/elasticsearch/elasticsearch:8.8.2
Check the Java location in DbSchema in the Help / About Dialog.
Open a command line and change the folder to the Java location above \lib\security. A file named carcerts should exists in that folder.
Copy the http_ca.crt file from the Elasticsearch server in the current folder.
If you are using docker containers, copy it from the docker image using :
docker cp elasticsearch:/usr/share/elasticsearch/config/certs/http_ca.crt .
Import the certificate in the Java carcerts using this command:
..\..\bin\keytool -import -trustcacerts -keystore cacerts -storepass changeit -noprompt -alias elasticsearch -file http_ca.crt
Connecting using DbSchema usually require the elasticsearch password. When using docker containers, this is printed out when first creating the docker container.
You can also choose to edit the JDBC URL and enter parameters like in the Elasticsearch documentation.
The typical URL for HTTPS connections is:
jdbc:es://https://localhost:9200
To create an index in Elasticsearch, I used:
curl -k --user "elastic:iSSBS=-sjfdjEqmIvpfZ" -H "Content-Type: application/json" -XPUT "https://localhost:9200/testindex?pretty" -d "{\"settings\" : {\"index\" : {\"number_of_shards\" : 3, \"number_of_replicas\" : 0 }}}"
To save a document, use
curl -k -H "Content-Type: application/json" --user "elastic:iSSBS=-sjfdjEqmIvpfZ" -XPOST "https://localhost:9200/testindex/_doc" -d"{\"timestamp\": \"2018-01-24 13:34:56\",\"message\": \"User Clicked Button\",\"user_id\": 4,\"admin\": false}"
To list the indexes:
curl -k --user "elastic:iSSBS=-sjfdjEqmIvpfZ" "https://localhost:9200/_cat/indices"
Please help us to improve the Elasticsearch support by writing us your feedback, using Help / Technical Support from the DbSchema menu.