I am unable to push the documents in the newly created index and add new fields to it using the kibana core API . Although I was able to do it with the dev tool. i want to implement this feature in my plugin to add documents and add new fields to it.
Something like this -
POST index name/type
{
"document1":"value"
}
Can you share the code you used?
Hello @flash1293 ,
router.post(
{
path: '/api/sip/addIndex',
validate: false,
},
async (context, request, response) => {
const body = {
mappings: {
properties: {
field1: { type: 'text' },
},
},
};
const results = await context.core.elasticsearch.client.asCurrentUser.indices.create({
index: 'harshit3',
body,
});
return response.ok({
body: { results },
});
}
);
I was able to create indexes using this piece of code . Now I want to add documents in the way I provided in the screenshot along with some new fields . Any suggestions how can I implement this?
the context.core.elasticsearch.client.asCurrentUser.create
method should allow you to create write new documents.
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.