docs/migration-guides/v5-to-v6.md
This guide helps you migrate from Jedis 5.x to Jedis 6.0.0. Version 6.0.0 includes breaking changes focused on Redis 8.0 support, removal of deprecated modules, and improvements to the Search API.
Jedis 6.0.0 is a major release that adds Redis 8.0 support and removes deprecated features. The main focus areas are:
RedisGraph module support has been completely removed from Jedis 6.0.0 as the module has been deprecated by Redis.
All classes in the redis.clients.jedis.graph package have been removed:
RedisGraphCommands interfaceRedisGraphPipelineCommands interfaceGraphCommandObjects classGraphCache, GraphProtocol, GraphQueryParams classesResultSet, ResultSetBuilder, Record, Header, Statistics classesEdge, Node, Path, Point, Property, GraphEntitySupport for Triggers and Functions (RedisGears v2) has been removed from Jedis 6.0.0.
All classes in the redis.clients.jedis.gears package have been removed:
RedisGearsCommands interfaceRedisGearsProtocol classTFunctionListParams, TFunctionLoadParams classesFunctionInfo, FunctionStreamInfo, GearsLibraryInfo, StreamTriggerInfo, TriggerInfoBREAKING: The default search dialect has changed from server-side default to DIALECT 2 (client-side override).
Starting with Jedis 6.0.0, all FT.SEARCH and FT.AGGREGATE commands automatically append DIALECT 2 unless explicitly configured otherwise. This may affect query results if you were relying on DIALECT 1 behavior.
Option 1: Accept DIALECT 2 (Recommended)
Review your search queries to ensure they work correctly with DIALECT 2. Most queries should work without changes.
Option 2: Revert to DIALECT 1
If you need to maintain DIALECT 1 behavior:
JedisPooled jedis = new JedisPooled("redis://localhost:6379");
// Set default dialect to 1
jedis.setDefaultSearchDialect(1);
// Now all search commands will use DIALECT 1
SearchResult result = jedis.ftSearch("idx:products", "@category:electronics");
The return type of FT.PROFILE commands has changed from Map<String, Object> to a structured ProfilingInfo object.
Before (v5.x):
Map.Entry<SearchResult, Map<String, Object>> ftProfileSearch(
String indexName, FTProfileParams profileParams, Query query);
Map.Entry<AggregationResult, Map<String, Object>> ftProfileAggregate(
String indexName, FTProfileParams profileParams, AggregationBuilder aggr);
After (v6.0.0):
Map.Entry<SearchResult, ProfilingInfo> ftProfileSearch(
String indexName, FTProfileParams profileParams, Query query);
Map.Entry<AggregationResult, ProfilingInfo> ftProfileAggregate(
String indexName, FTProfileParams profileParams, AggregationBuilder aggr);
The response format for COMMAND INFO has been updated to include subcommand details, making it compatible with Redis 7.0+ and Redis 8.0.
If you were parsing the COMMAND INFO response, you may need to update your code to handle the new structure that includes subcommand information.
Before (v5.x):
List<Object> commandInfo = jedis.commandInfo("SET");
// Returns basic command information
After (v6.0.0):
List<Object> commandInfo = jedis.commandInfo("SET");
// Returns command information including subcommand details
// Compatible with Redis 7.0+ format
Jedis 6.0.0 adds full support for Redis 8.0, which includes built-in support for:
Example:
JedisPooled jedis = new JedisPooled("redis://localhost:6379");
// JSON operations (built-in in Redis 8.0)
jedis.jsonSet("user:1", Path2.of("$"), "{\"name\":\"John\",\"age\":30}");
String json = jedis.jsonGet("user:1");
// Search operations (built-in in Redis 8.0)
jedis.ftCreate("idx:users",
FTCreateParams.createParams()
.on(IndexDataType.JSON)
.addPrefix("user:"),
TextField.of("$.name").as("name"),
NumericField.of("$.age").as("age"));
SearchResult result = jedis.ftSearch("idx:users", "@name:John");
A new SslOptions class provides advanced SSL/TLS configuration options for secure connections.
Features:
Example:
SslOptions sslOptions = SslOptions.builder()
.keystore(new File("/path/to/keystore.jks"))
.keystorePassword("keystorePassword".toCharArray())
.truststore(new File("/path/to/truststore.jks"))
.truststorePassword("truststorePassword".toCharArray())
.sslVerifyMode(SslVerifyMode.FULL)
.build();
JedisClientConfig config = DefaultJedisClientConfig.builder()
.ssl(true)
.sslOptions(sslOptions)
.build();
JedisPooled jedis = new JedisPooled("localhost", 6379, config);
Jedis 6.0.0 introduces support for token-based authentication, useful for cloud environments and managed Redis services.
Example:
// Token-based authentication with automatic token refresh
TokenCredentials tokenCredentials = new TokenCredentials("initial-token");
JedisClientConfig config = DefaultJedisClientConfig.builder()
.credentials(tokenCredentials)
.build();
JedisPooled jedis = new JedisPooled("localhost", 6379, config);
// Token can be updated dynamically
tokenCredentials.updateToken("new-token");
Support for new hash field expiration commands introduced in Redis 7.4:
HGETDEL - Get and delete a hash fieldHGETEX - Get a hash field with expiration optionsHSETEX - Set a hash field with expirationExample:
// HSETEX - Set field with expiration
jedis.hsetex("user:1", 3600, "session", "abc123");
// HGETEX - Get field and update expiration
String session = jedis.hgetex("user:1", "session",
HGetExParams.hgetExParams().ex(7200));
// HGETDEL - Get and delete field
String oldSession = jedis.hgetdel("user:1", "session");
Search and aggregation queries now support warning messages in results, helping identify potential issues with queries.
Example:
SearchResult result = jedis.ftSearch("idx:products", "@name:laptop");
// Check for warnings
if (result.hasWarnings()) {
List<String> warnings = result.getWarnings();
warnings.forEach(warning ->
System.out.println("Search warning: " + warning));
}
If you encounter issues during migration: