I am using @elastic/elasticsearch
library in my node project and i am trying to create an index like this
const { Client } = require('@elastic/elasticsearch')
const client = new Client({ node: 'http://localhost:9200' })
await client.index({
index: 'myIndex',
refresh: true,
body: {
category: '',
something_else: ''
}
})
When i am trying to fetch a record
const { body } = await client.search({
index: 'myIndex',
body: {
query: {
"match_all": {}
}
}
})
The response is
{
"_index": "myIndex",
"_type": "_doc",
"_id": "cjijWHEBHKa8WEr-JNYu",
"_score": 1,
"_source": {}
},