Hello there,
I'm having issues making a query on a Elasticsearch db.
Indeed, if I make this request:
POST my-index/_search
I get almost all documents in the index.
In this way:
{
"took" : 15,
"timed_out" : false,
"_shards" : {
"total" : 3,
"successful" : 3,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 1016,
"relation" : "eq"
},
"max_score" : 1.0,
"hits" : [
{
"_index" : "my-index",
"_type" : "_doc",
"_id" : "c1d69d7c-8ec6-4623-b550-1c0570882810",
"_score" : 1.0,
"_source" : {
"document_id" : "c1d69d7c-8ec6-4623-b550-1c0570882810",
"document_name" : "1234_MYDOC.pdf",
"document_project" : [
"A PROJECT NAME"
],
"document_path" : "c1d69d7c-8ec6-4623-b550-1c0570882810/1234_MYDOC.pdf",
"uploaded_at" : "2023-04-14T07:38:25.672572",
"uploaded_by" : "user@mail.com",
"status" : "FAILED",
"document_text" : null,
"status_message" : "some error"
}
}
... #more documents here
]```
The issue I'm facing is while trying to get a result by document id.
Such as
POST /my-index/_search
{
"query": {
"term": {
"document_name": "1234_MYDOC.pdf"
}
}
}
A query like this, will return
{
"error" : {
"root_cause" : [
{
"type" : "parsing_exception",
"reason" : "[document_name] query malformed, no start_object after query name",
"line" : 2,
"col" : 30
}
],
"type" : "parsing_exception",
"reason" : "[document_name] query malformed, no start_object after query name",
"line" : 2,
"col" : 30
},
"status" : 400
}
Similar 400 results also happen when I search for a catchall term.
Could you help?