nicolasff / webdis

A Redis HTTP interface with JSON output
https://webd.is
BSD 2-Clause "Simplified" License
2.82k stars 307 forks source link

Support for Redis Stack expected? #226

Open OskarHowe opened 2 years ago

OskarHowe commented 2 years ago

Hi, I am wondering if you planned to publish a version of webdis which supports Redis Stack. It's been released recently and brings a lot of features, and it would be amazing to query Redis Stack directly from a web app.

nicolasff commented 2 years ago

Hello,

I had never heard of Redis Stack before your question, but their website says:

Redis Stack is built on Redis and uses the same client protocol as Redis. As a result, most Redis client libraries work with Redis Stack.

So it seems to me that Webdis should "just work". Have you tried it? And if so, does your question mean that it did not work? If this is why you feel you can't use webdis with Redis Stack, a more detailed error report would definitely help.

iusik commented 1 year ago

I'am trying to send request http://127.0.0.1:7379/FT.SEARCH/targeting/@languages:%7Bus%7D and get error:

{
FT.SEARCH: [
false,
"ERR unknown command `FT.SEARCH`, with args beginning with: `targeting`, `@languages:{us}`, "
]
}
VagyokC4 commented 1 year ago

Any movement on this? I too would like to use FT.SEARCH commands.

nicolasff commented 1 year ago

@VagyokC4 have you tried using Webdis with Redis Stack? From the previous comment it seems like the request was sent to a Webdis instance running against a regular Redis, not Redis Stack. Webdis does not "know" about commands, not really. It's not like it has a list of commands it knows about, is what I mean. So when an error message says "ERR unknown command FT.SEARCH", that's not from Webdis… it's from Redis. The regular Redis.

There was a discussion 2 years ago in #188 where the command FT.INFO was used, for example. Again Webdis did not need to know about it, it just takes its input from the request path and converts it into a Redis command that it just passes along. The only step where an incompatibility could prevent a successful response is in Webdis' processing of the Redis response, and converting it to JSON. If the response has a format that Webdis doesn't understand, it could very well fail.

This is not what is happening with the FT.SEARCH request shown above.

If you do configure Webdis to talk to Redis Stack and it doesn't work, I'd be happy to look into it.

VagyokC4 commented 1 year ago

Awesome. I will try to test this and report back for others looking.

Update: @nicolasff I was able to set the following command via post without any issue.

JSON.SET example $ '[ true, { "answer": 42 }, null ]'

becomes a POST with body

JSON.SET/example/$/[ true, { "answer": 42 }, null ]

Also, I did have to add the commands via webdis.prod.json

{
    "enabled": ["JSON.SET", "JSON.GET"],
    "http_basic_auth": "*:*"
}

I think this issue can be closed out as it appears to pass-through as expected.

nicolasff commented 1 year ago

@VagyokC4 awesome! Thank you for trying this and reporting back here, this will be very helpful if anyone wants to use Webdis with Redis Stack in the future.

I was thinking I might add a section about it to the README, or maybe even a page in the docs/ folder. I might as well ask you: when you were trying to figure out if Webdis supported Redis Stack – so before commenting on this issue – did you try to search the README for it, or did you look in the docs folder? If there's somewhere you looked at that doesn't mention it today but could mention it, it would give me an idea of where it might be useful to add this information.

If you just googled it, then the README would probably work. I see that this issue can be found easily with a Google search for "webdis" "redis stack", and I would expect Google to find a dedicated entry in the README.

This will also give me a chance to give Redis Stack a try for myself, to get a better understanding of the kind of responses it can produce (it's really only on the response path that it can get confused, sending commands is always straightforward).

Best, Nicolas

VagyokC4 commented 1 year ago

when you were trying to figure out if Webdis supported Redis Stack – so before commenting on this issue – did you try to search the README for it, or did you look in the docs folder?

Hi @nicolasff, so interestingly enough, I came across your package as recommended by ChatGPT. Once I got to your github, I looked through the issues to see what issues people were having with it, and that's where I came across the RedisStack issue, and from the reading, it looked like it was not supported.

My typical search-case is to look at the README, and then to follow it to any Docs/Wiki if I'm looking for information on how to use it. I didn't even look in the src to see the docs folder, so maybe linking the wiki to the docs folder so one can click to it straight away? So full disclosure, it was CharGPT that gave me the recommendation to add the commands to the config file, which enabled my test to work. (Before that I was a little stuck)

nicolasff commented 1 year ago

I came across your package as recommended by ChatGPT.

Amazing! Definitely not the answer I expected, I'll have to ask it about HTTP interfaces to Redis. I have a docs page almost ready documenting this use case, I still have to proofread it and maybe tweak it a little, but I'll merge it pretty soon.

The Wiki feature is turned off for this project, but I could definitely make the docs more visible in the README; I hadn't thought of that.