A GraphQL server backed by Redis
- Query Redis data using GraphQL
- Full text search on fields in Redis Data
- Numeric range queries
- Negative and optional matches
- Aggregate data for reporting
- Geographic matching
- Only minimal configuration required
The GraphQL server queries RediSearch for the search schema then dynamically builds the GraphQL schema.
Data is stored in a Redis Hash data structure
For example we have a list of gaming users and we want to be able to search these users by fields
Field | Example Value |
---|---|
username | jennifer82 |
location | 41.09822,120.74792 |
rating | 591 |
playstyle | stationary,sniper |
jennifer.lewis@example.com |
HSET user:jennifer82 username jennifer82 rating 591 email jennifer.lewis@example.com playstyle stationary,sniper location 122.4194,37.7749
FT.CREATE Gamers ON HASH PREFIX 1 user: SCHEMA username TEXT location GEO SORTABLE rating NUMERIC SORTABLE playstyle TAG email TAG
Note: Please do not use :
or -
in the Index name. _
is acceptable.
See Tips and Tricks for more detailed information on creating a Redisearch schema
./redis-graphql --redis-host localhost --redis-port 6379
curl -s -X POST -H "Content-Type: application/json" --data '{"query": "{ Gamers(username:\"jennifer82\") {username,email,rating}}"}' http://localhost:8080/graphql
{
"data": {
"Gamers": [
{
"email": "jennifer.lewis@example.com",
"rating": 591,
"username": "jennifer82"
}
]
}
}
See Querying and Aggregations for more detailed query examples
Example Prometheus/Grafana Setup is available