Show examples in:
Javascript HTTP
Endpoint info
Available examples
Content Management API > Search Index

Update a search index

Body parameters

name string Optional

Name of the search index

Example: "Production Website"
enabled boolean Optional

Whether the search index is enabled or not

frontend_url string, null Optional

The public URL of the website. This is the starting point from which the website's spidering will start

Example: "https://www.mywebsite.com/"
user_agent_suffix string, null Optional

Optional suffix to append to the DatoCmsSearchBot user agent when indexing the website

Example: "v1.0.0"
build_triggers Optional

The build triggers that can trigger this search index

Returns

Returns a resource object of type search_index

Examples

import { buildClient } from "@datocms/cma-client-node";
async function run() {
const client = buildClient({ apiToken: process.env.DATOCMS_API_TOKEN });
const searchIndexId = "1822";
const searchIndex = await client.searchIndexes.update(searchIndexId, {
id: "1822",
});
// Check the 'Returned output' tab for the result ☝️
console.log(searchIndex);
}
run();
{
id: "1822",
name: "Production Website",
enabled: true,
frontend_url: "https://www.mywebsite.com/",
user_agent_suffix: "v1.0.0",
meta: {
indexing_status: "success",
last_indexing_completed_at: "2025-03-30T09:29:14.872Z",
},
build_triggers: [{ type: "build_trigger", id: "1822" }],
}