myspark is a simple tool for generating mock hotel data in JSON format, suitable for bulk insertion into your local Elasticsearch instance.
Each document includes a timestamp, making it ideal for time-based visualizations such as histogram aggregations.
- Create a JSON file for bulk Elasticsearch inserts
- Send mock data directly to Elasticsearch (if security is disabled)
- Customizable timestamps for testing time-series queries
- Lightweight web UI to trigger actions
- JDK 1.8.0 or higher (Oracle JDK or OpenJDK)
- Download the latest myspark JAR
- Run it via double-click or from the command line:
java -jar myspark.jar
This launches a lightweight web server and opens the UI in your default browser.
http://localhost:4567/<action>/<interval>/<count>
-
action:
create
: generates a JSON file with mocked documentsbulk
: sends the documents directly to your local Elasticsearch
-
interval:
Timestamp interval for each documents
: secondsm
: minutesh
: hoursd
: days
-
count:
Number of documents to generate
curl http://localhost:4567/create/m/5000
- This creates a bulkable JSON file in your
$HOME
directory.
curl http://localhost:4567/bulk/d/3600
Note: Direct bulk insertion only works if Elasticsearch security is disabled (
xpack.security.enabled: false
inelasticsearch.yml
).
Here’s a helper script to run the tool and automatically trigger a create action:
#!/bin/bash
export JAVA_HOME="/Users/surfer/elastic/labs/7.17.4/elasticsearch/jdk.app/Contents/Home"
# Check if myspark is already running
jps | grep myspark.jar > /dev/null
if [ $? != 0 ]; then
java -jar myspark.jar &
sleep 2
fi
# Trigger data generation
curl http://localhost:4567/create/h/$1
Save this as do_it.sh
, make it executable with chmod +x do_it.sh
, and run:
./do_it.sh 1000
This example creates 1,000 documents with hourly timestamps.
Let me know if you'd like to add more advanced examples (like Kibana visualizations or bulk
curl-based replays).