how to used to spring-lettucemod create index on json(java)

182 Views Asked by At

enter image description hereenter image description here

I create a redissearch index with spring-lettucemod,but the Index is Hash type ,not the JSON type,I can't find the Options to change the Hash on CreateOptions or RedisModulesCommands,Please god give advice or comments

1

There are 1 best solutions below

0
finary On
 TagField<String> tagField = Field.tag(indexJSONPath).as(tagName).build();
Field<String>[] fields = new Field[]{tagField};

CreateOptions<String, String> options = CreateOptions.<String, String>builder()
                                                     .prefix(prefix)
                                                     .on(CreateOptions.DataType.JSON)
                                                     .build();

return connection.reactive()
                 .ftCreate(index, options, fields);

Super simplistic example.