Skip to content

Documentation missing in Java documentation: how to clear an index before sending new data to Algolia #1164

Open
@FDelporte

Description

@FDelporte

Description

It's unclear now what is the best method to clear an index before sending new data.

I used this approach, but it's not clear to me if this will be executed in the correct order:

            List<BatchRequest> requests = new ArrayList<>();

            requests.add(new BatchRequest().setAction(Action.CLEAR));

            for (ContentSection section : sections) {
                requests.add(new BatchRequest()
                        .setAction(Action.ADD_OBJECT)
                        .setBody(section)
                );
            }

            BatchResponse response = client.batch(ALGOLIA_INDEX, new BatchWriteParams().setRequests(requests));

            client.waitForTask(ALGOLIA_INDEX, response.getTaskID());

Steps to reproduce

This page: https://api-clients-automation.netlify.app/docs/clients/guides/send-data-to-algolia

Environment

  • Java API

Metadata

Metadata

Assignees

No one assigned

    Labels

    JavaIssue related to the Java client

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions