quickwit-oss / quickwit-oss/quickwit
different 404 search results using SDK and HTTP request
Open
@guilload is already working on this.
Since May 6, 2024.
bug
- Dominant language
- Rust
- Stars
- 11.7k
- Forks
- 597
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 37
Description
Describe the bug
we get different 404 search results using SDK and HTTP requests when searching an not existed index.
QW version: v0.8.1
Go SDK: go-elastic v7.17.1
Python SDK: elasticsearch 8.13.1
The results returned by SDK do not work as expected. That makes us confused.
I tried to read the Rust code but did not find any idea about how to fix it.
HTTP Request
curl -L -X POST 'http://127.0.0.1:7280/api/v1/_elastic/qw-test/_search' -H 'Content-Type: application/json' -d '{
"query": {
"match_all": {}
}
}'
Result
{
"status": 404,
"error": {
"caused_by": null,
"reason": "could not find indexes matching the IDs `[\"qw-test\"]`",
"stack_trace": null,
"type": null
}
}
Go SDK
cfg := elasticsearch.Config{
Addresses: []string{
"http://127.0.0.1:7280/api/v1/_elastic",
},
}
es, err := elasticsearch.NewClient(cfg)
if err != nil {
log.Fatalf("Error creating the client: %s", err)
}
query := `{"query": {"match_all": {}}}`
res, err := es.Search(
es.Search.WithContext(context.Background()),
es.Search.WithIndex("qw-test"),
es.Search.WithBody(strings.NewReader(query)),
es.Search.WithPretty(),
)
if err != nil {
log.Fatalf("Error getting response: %s", err)
}
defer res.Body.Close()
if res.IsError() {
str, _ := json.Marshal(res)
fmt.Println(string(str))
return
}
Result:
{
"StatusCode": 404,
"Header": {
"Access-Control-Allow-Origin": [
"*"
],
"Vary": [
"origin",
"access-control-request-method",
"access-control-request-headers"
],
"Date": [
"Sat, 04 May 2024 09:46:56 GMT"
],
"Content-Type": [
"application/json"
],
"X-Elastic-Product": [
"Elasticsearch"
]
},
"Body": {}
}
Python SDK
from elasticsearch import Elasticsearch
es = Elasticsearch("http://127.0.0.1:7280/api/v1/_elastic")
try:
response = es.search(index="qw-test", body={"query": {"match_all": {}}})
print(response)
except Exception as e:
print(f"An error occurred: {e}")
Result:
An error occurred: NotFoundError(404, None)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.