DbSchema is a Elasticsearch ER diagram database designer and query tool. Using DbSchema, you can design and document Elasticsearch databases while connected to the database server or without a connection.
Next, you can share the design with the team using Git. The design model loaded in DbSchema can be compared with the database, synchronization scripts can be generated, and the schema can be deployed to any database server.
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.