deleteObject
This helper method deletes multiple records from an index by their objectID.
It constructs a Batch request with the deleteObject action
and automatically sends requests in batches of 1,000.
Usage
List<BatchResponse> response = await client.DeleteObjectsAsync(
"INDEX_NAME",
new List<string> { "1", "2" }
);
response, err := client.DeleteObjects(
"INDEX_NAME",
[]string{"1", "2"})
if err != nil {
// handle the eventual error
panic(err)
}
// response is a slice of search.BatchResponse
List<BatchResponse> response = client.deleteObjects("INDEX_NAME", Arrays.asList("1", "2"));
const response: BatchResponse[] = await client.deleteObjects({
indexName: 'INDEX_NAME',
objectIDs: ['1', '2'],
});
var response: List<BatchResponse> =
client.deleteObjects(indexName = "INDEX_NAME", objectIDs = listOf("1", "2"))
/** @var array<BatchResponse> $response */
$response = $client->deleteObjects(
'INDEX_NAME',
[
'1',
'2',
],
);
response: list[BatchResponse] = client.delete_objects(
index_name="INDEX_NAME",
object_ids=[
"1",
"2",
],
)
response = client.delete_objects("INDEX_NAME", ["1", "2"])
# response is an array of BatchResponse objects
val response: Seq[BatchResponse] = Await.result(
client.deleteObjects(
indexName = "INDEX_NAME",
objectIDs = Seq("1", "2")
),
Duration(100, "sec")
)
let response: [BatchResponse] = try await client.deleteObjects(
indexName: "INDEX_NAME",
objectIDs: ["1", "2"]
)
Parameter
- C#
- Go
- Java
- JavaScript
- Kotlin
- PHP
- Python
- Ruby
- Scala
- Swift
string
required
Index name from which to delete records.
IEnumerable
required
Object IDs for records to delete.
bool
default:false
Whether to wait until all batch requests are done.
cancellationToken
default:"default"
Parameter that can be used as a signal to cancel the request.
RequestOptions
Additional request options.
string
required
Index name from which to delete records.
[]string
required
Object IDs for records to delete.
ChunkedBatchOption
Functional options to provide extra arguments.
Show available functions
Show available functions
function
Signature:
func(batchSize int) chunkedBatchOptionSets the number of object IDs to process in one batch.
The default batch size is 1,000.function
Signature:
func(withWaitForTasks bool) chunkedBatchOptionWhether to wait until all batch requests are done.function
Signature:
func(key string, value string) requestOptionSets extra header parameters for this request.
To learn more, see request options.function
Signature:
func(key string, value string) requestOptionSets extra query parameters for this request.
To learn more, see request options.String
required
Index name from which to delete records.
List<String>
required
Object IDs for records to delete.
boolean
default:false
Whether to wait until all batch requests are done.
RequestOptions
Additional request options.
string
required
Index name from which to delete records.
string[]
required
Object IDs for records to delete.
boolean
default:false
Whether to wait until all batch requests are done.
RequestOptions
Additional request options.
String
required
Index name from which to delete records.
List<String>
required
Object IDs for records to delete.
Boolean
default:false
Whether to wait until all batch requests are done.
RequestOptions
Additional request options.
string
required
Index name from which to delete records.
string[]
required
Object IDs for records to delete.
array
Additional request options.
str
required
Index name from which to delete records.
list[str]
required
Object IDs for records to delete.
bool
default:"False"
Whether to wait until all batch requests are done.
dict | RequestOptions
Additional request options.
String
required
Index name from which to delete records.
Array[String]
required
Object IDs for records to delete.
bool
default:false
Whether to wait until all batch requests are done.
Hash
Additional request options.
String
required
Index name from which to delete records.
Seq[String]
required
Object IDs for records to delete.
Boolean
default:false
Whether to wait until all batch requests are done.
Option[RequestOptions]
Additional request options.
String
required
Index name from which to delete records.
[String]
required
Object IDs for records to delete.
Bool
default:false
Whether to wait until all batch requests are done.
RequestOptions
Additional request options.