Sending requests to Elasticsearch with axios

I'm working on a react app which needs to fetch data from elsaticsearch. In frontend, actually I'm trying to use axios to do the request:

const query = {
query: {
match: {
"_id": "AV12n5KzsohD5gXzTnOr"
}
}
};

axios.get('http://localhost:9200/my-index/my-type/_search', query)
.then((res) => {
console.log(res);
});

I want to get the specific document with some ID. The above query actually works inside kibana. However, the above query returns all the documents inside my-type, what am I doing wrong here?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.