Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dropindex method is mapped on FT.DROP Redis Command not on FT.DROPINDEX #182

Open
alesAlten opened this issue Apr 7, 2022 · 0 comments
Open

Comments

@alesAlten
Copy link

The current implementation of "dropIndex" method, sends to Redis the FT.DROP command, not the FT.DROPINDEX.
The difference is that FT.DROP command delete all documents in the index (tested with JSON document), while FT.DROPINDEX command (without DD parameter) does not delete all documents.
At the moment is not possible programmatically to delete an index without deleting all documents indexed.

I attach a snippet of the Java code and the result of MONITOR command executed on a test environment.
It shows as "rediSearchClient.dropIndex();" produce a "FT.DROP" "RootElementIDX" command. Automatically Redis delete the only document indexed in that moment (is JSON not an HASH) prior to drop the index: 1649349429.302994 [0 ?:0] "DEL" "RootElement:root-1"

To replicate:
-----------Java code (createIndex is a private method that create the index, and redisSearchClientFactory is a factory method thaht creates an instance of the Client):

rediSearchClient = redisSearchClientFactory.apply("RootElementIDX");
rediSearchClient.getInfo();
rediSearchClient.dropIndex();
createIndex(rediSearchClient);

---------- Output of MONITOR command in a test environment

1649349429.300631 [0 172.18.0.1:44168] "FT.INFO" "RootElementIDX"
1649349429.302994 [0 ?:0] "DEL" "RootElement:root-1"
1649349429.303077 [0 172.18.0.1:44168] "FT.DROP" "RootElementIDX"
1649349429.306463 [0 172.18.0.1:44168] "FT.CREATE" "RootElementIDX" "ON" "JSON" "PREFIX" "1" "RootElement:" "SCHEMA" "$.id" "AS" "id" "TEXT" "$.score" "AS" "score" "NUMERIC" "SORTABLE"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant