Meilisearch PHP | Documentation

HandlesDocuments

Table of Contents

Methods

addDocuments()  : Task
addDocumentsCsv()  : Task
addDocumentsCsvInBatches()  : array<int, Task>
addDocumentsInBatches()  : array<int, Task>
addDocumentsJson()  : Task
addDocumentsNdjson()  : Task
addDocumentsNdjsonInBatches()  : array<int, Task>
deleteAllDocuments()  : Task
deleteDocument()  : Task
deleteDocuments()  : Task
getDocument()  : array<string|int, mixed>
getDocuments()  : DocumentsResults
updateDocuments()  : Task
updateDocumentsByFunction()  : Task
This is an EXPERIMENTAL feature, which may break without a major version.
updateDocumentsCsv()  : Task
updateDocumentsCsvInBatches()  : array<int, Task>
updateDocumentsInBatches()  : array<int, Task>
updateDocumentsJson()  : Task
updateDocumentsNdjson()  : Task
updateDocumentsNdjsonInBatches()  : array<int, Task>
batch()  : Generator
batchCsvString()  : Generator
batchNdjsonString()  : Generator

Methods

addDocuments()

public addDocuments(array<string|int, mixed> $documents[, string|null $primaryKey = null ]) : Task
Parameters
$documents : array<string|int, mixed>
$primaryKey : string|null = null
Return values
Task

addDocumentsCsv()

public addDocumentsCsv(string $documents[, string|null $primaryKey = null ][, string|null $delimiter = null ]) : Task
Parameters
$documents : string
$primaryKey : string|null = null
$delimiter : string|null = null
Return values
Task

addDocumentsCsvInBatches()

public addDocumentsCsvInBatches(string $documents[, int|null $batchSize = 1000 ][, string|null $primaryKey = null ][, string|null $delimiter = null ]) : array<int, Task>
Parameters
$documents : string
$batchSize : int|null = 1000
$primaryKey : string|null = null
$delimiter : string|null = null
Return values
array<int, Task>

addDocumentsInBatches()

public addDocumentsInBatches(array<string|int, mixed> $documents[, int|null $batchSize = 1000 ][, string|null $primaryKey = null ]) : array<int, Task>
Parameters
$documents : array<string|int, mixed>
$batchSize : int|null = 1000
$primaryKey : string|null = null
Return values
array<int, Task>

addDocumentsJson()

public addDocumentsJson(string $documents[, string|null $primaryKey = null ]) : Task
Parameters
$documents : string
$primaryKey : string|null = null
Return values
Task

addDocumentsNdjson()

public addDocumentsNdjson(string $documents[, string|null $primaryKey = null ]) : Task
Parameters
$documents : string
$primaryKey : string|null = null
Return values
Task

addDocumentsNdjsonInBatches()

public addDocumentsNdjsonInBatches(string $documents[, int|null $batchSize = 1000 ][, string|null $primaryKey = null ]) : array<int, Task>
Parameters
$documents : string
$batchSize : int|null = 1000
$primaryKey : string|null = null
Return values
array<int, Task>

deleteDocument()

public deleteDocument(string|int $documentId) : Task
Parameters
$documentId : string|int
Return values
Task

deleteDocuments()

public deleteDocuments(array<string|int, mixed> $options) : Task
Parameters
$options : array<string|int, mixed>
Return values
Task

getDocument()

public getDocument(non-empty-string|int $documentId[, array<string|int, mixed>|null $fields = null ]) : array<string|int, mixed>
Parameters
$documentId : non-empty-string|int
$fields : array<string|int, mixed>|null = null
Return values
array<string|int, mixed>

updateDocuments()

public updateDocuments(array<string|int, mixed> $documents[, string|null $primaryKey = null ]) : Task
Parameters
$documents : array<string|int, mixed>
$primaryKey : string|null = null
Return values
Task

updateDocumentsByFunction()

This is an EXPERIMENTAL feature, which may break without a major version.

public updateDocumentsByFunction(non-empty-string $function[, array{filter?: non-empty-string|list|null, context?: array$options = [] ]) : Task

It's available after Meilisearch v1.10.

More info about the feature: https://github.com/orgs/meilisearch/discussions/762 More info about experimental features in general: https://www.meilisearch.com/docs/reference/api/experimental-features

Parameters
$function : non-empty-string
$options : array{filter?: non-empty-string|list|null, context?: array} = []
Return values
Task

updateDocumentsCsv()

public updateDocumentsCsv(string $documents[, string|null $primaryKey = null ][, string|null $delimiter = null ]) : Task
Parameters
$documents : string
$primaryKey : string|null = null
$delimiter : string|null = null
Return values
Task

updateDocumentsCsvInBatches()

public updateDocumentsCsvInBatches(string $documents[, int|null $batchSize = 1000 ][, string|null $primaryKey = null ][, string|null $delimiter = null ]) : array<int, Task>
Parameters
$documents : string
$batchSize : int|null = 1000
$primaryKey : string|null = null
$delimiter : string|null = null
Return values
array<int, Task>

updateDocumentsInBatches()

public updateDocumentsInBatches(array<string|int, mixed> $documents[, int|null $batchSize = 1000 ][, string|null $primaryKey = null ]) : array<int, Task>
Parameters
$documents : array<string|int, mixed>
$batchSize : int|null = 1000
$primaryKey : string|null = null
Return values
array<int, Task>

updateDocumentsJson()

public updateDocumentsJson(string $documents[, string|null $primaryKey = null ]) : Task
Parameters
$documents : string
$primaryKey : string|null = null
Return values
Task

updateDocumentsNdjson()

public updateDocumentsNdjson(string $documents[, string|null $primaryKey = null ]) : Task
Parameters
$documents : string
$primaryKey : string|null = null
Return values
Task

updateDocumentsNdjsonInBatches()

public updateDocumentsNdjsonInBatches(string $documents[, int|null $batchSize = 1000 ][, string|null $primaryKey = null ]) : array<int, Task>
Parameters
$documents : string
$batchSize : int|null = 1000
$primaryKey : string|null = null
Return values
array<int, Task>

batch()

private static batch(array<string|int, mixed> $documents, int $batchSize) : Generator
Parameters
$documents : array<string|int, mixed>
$batchSize : int
Return values
Generator

batchCsvString()

private static batchCsvString(string $documents, int $batchSize) : Generator
Parameters
$documents : string
$batchSize : int
Return values
Generator

batchNdjsonString()

private static batchNdjsonString(string $documents, int $batchSize) : Generator
Parameters
$documents : string
$batchSize : int
Return values
Generator

        
On this page

Search results