logo

English

Index Documents

Using Promises

    client.indexDocuments([
        {
            id: 1,
            title: "Finish interior design project",
            tags: ["research", "design"],
            url: "https://www.my-website.com/all-tasks/finish-interior-design-project",
        },
        {
            id: 2,
            title: "Update building process time",
            tags: ["performance"],
            url: "https://www.my-website.com/all-tasks/build-process-time",
        },
    ])
    .then(response => {
        //...
    })

Using ES7 async/await


async function indexMyDocuments(){

    const response = await client.indexDocuments([
        {
            id: 1,
            title: "Finish interior design project",
            tags: ["research", "design"],
            url: "https://www.my-website.com/all-tasks/finish-interior-design-project",
        },
        {
            id: 2,
            title: "Update building process time",
            tags: ["performance"],
            url: "https://www.my-website.com/all-tasks/build-process-time",
        },
    ]);

}