so I am making a request to elasticSearch and I want to filter the data received by Timestamp value, I want every data between 6 and 8 A.M. for example. In postman the Body → raw is something like this:
Copy pasting the same question after an hour doesn’t get you more replies (Also having to wait for an hour is not that uncommon. Depending on how many people have the expertise to help you, you sometimes need to wait a few days.)
I have no idea about elasticSearch, their api or whether your query is correct so I can’t help you with that. If your problem is a kotlin error you should post the error message. If the error is related to elasticSearch you should firstly explain what you get for an result, what you expect but also maybe try to look for a elasticSearch forum or some place with people who use it so they can help you.
It’s the first time I use the forum, wanted to spread to at least two topics I am sorry for the abuse, won’t happen again.
It doesn’t give any error message, the querry that is supposed to filter the data just doesn’t do anything in the other hand in a postman request that querry does work.
Thanks for the information about the waiting time for a reply, wasn’t aware of it.
That may be why the Kotlin client doesn’t send the body you’re providing. Usually a REST API uses POST to include parameters in the body, even if you’re doing a GET-like thing; or uses GET with parameters in the query string. Are you sure the ElasticSearch API doesn’t specify POST for this? If it does specify GET with a request body, it’s a bad, non-standard API!
I am using Spring MVC as the support for the application and as I searched I found that Spring doesn’t support a body in a GET request. I tried to make the same request but changed the request to POST and it changed some indexes of elasticsearch used for testing.
Don’t really know what I should use now
ElasticSearch likes to use GET request for all read-only operations, including searching. Since ElasticSearch is mainly a search engine, and a fairly complex one at that, search requests are often too complex to be expressed without JSON request body. As a result, ElasticSearch makes heavy use of request bodies in GET request. It’s not part of the HTTP standard, but that is how they do it.
My recommendation is, if possible, use an ElasticSearch client library rather than a generic HTTP client. If you are developing for the JVM, then there is the client for Java, as well as some community created adapters for Kotlin.