This demo uses the query and REST capabilities of Infinispan Server to help you battle Pokemons!
Data is ingested as JSON, and internally stored efficiently as Protobuf. Both query and retrieval happens using JSON taking advantage of the mapping between Protobuf and JSON present in Infinispan
- Download the dataset
archive.zip
from https://www.kaggle.com/rounakbanik/pokemon - Make sure Python 3 installed
python --version
-
Start Infinispan Server:
docker run -it --name infinispan-server -p 11222:11222 -e "USER=user" -e "PASS=user" infinispan/server:13.0
-
Prepare data
python3 prepare-data.py
-
Creating an indexed cache
curl -u user:user --digest -H "Content-Type: application/json" -d '{"distributed-cache":{"mode":"SYNC","encoding":{"key":{"media-type":"application/x-protostream"},"value":{"media-type":"application/x-protostream"}},"indexing":{"indexed-entities":["Pokemon"]}}}' http://127.0.0.1:11222/rest/v2/caches/pokemon
-
Register the protobuf schema
curl -u user:user --digest --data-binary @./pokemon.proto http://127.0.0.1:11222/rest/v2/schemas/pokemon.proto
-
Ingest data
./ingest-data.sh
Example queries:
-
Get Pokemon by key (name)
-
Get all Pokemons:
-
Count Pokemons by generation:
-
Do a full text search on the name
-
Select top 5 Pokemons that can better withstand fire: