Skip to content

V1.16: Update /batches response #3314

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: v1.16
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions reference/api/batches.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@ The `/batches` route gives information about the progress of batches of [asynchr
},
"progressTrace": { … },
"writeChannelCongestion": { … },
"internalDatabaseSizes": { … }
"internalDatabaseSizes": { … },
"embedderRequests": {
"total": 12,
"failed": 5,
"lastError": "runtime error: received internal error HTTP 500 from embedding server\n - server replied with `{\"error\":\"Service Unavailable\",\"text\":\"will_error\"}`"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This snippet came from a test, it's not need it would just confuse readers

Suggested change
"lastError": "runtime error: received internal error HTTP 500 from embedding server\n - server replied with `{\"error\":\"Service Unavailable\",\"text\":\"will_error\"}`"
"lastError": "runtime error: received internal error HTTP 500 from embedding server\n - server replied with `{\"error\":\"Service Unavailable\"}`"

}
},
"duration": "PT0.250518S",
"startedAt": "2024-12-10T15:20:30.18182Z",
Expand Down Expand Up @@ -123,6 +128,12 @@ Object containing information on write operations computed during indexing. Can

Size of each internal database, including by how much it changed after a batch was processed.

#### `embedderRequests`

Object containing the total number of requests made to the embedder. Also displays the number of failed tasks, if any, along with the error message for the most recent failure.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Object containing the total number of requests made to the embedder. Also displays the number of failed tasks, if any, along with the error message for the most recent failure.
Object containing the total number of requests made to the embedder. Also displays the number of failed requests, if any, along with the error message for the most recent failure.


Only present in batches with at least one task querying an embedder. This field continuously updates until Meilisearch finishes processing the batch.

### `duration`

**Type**: String<br />
Expand Down Expand Up @@ -219,7 +230,12 @@ For example, `?uids=0` returns a batch containing the task with a `taskUid` equa
},
"progressTrace": { … },
"writeChannelCongestion": { … },
"internalDatabaseSizes": { … }
"internalDatabaseSizes": { … },
"embedderRequests": {
"total": 12,
"failed": 5,
"lastError": "runtime error: received internal error HTTP 500 from embedding server\n - server replied with `{\"error\":\"Service Unavailable\",\"text\":\"will_error\"}`"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"lastError": "runtime error: received internal error HTTP 500 from embedding server\n - server replied with `{\"error\":\"Service Unavailable\",\"text\":\"will_error\"}`"
"lastError": "runtime error: received internal error HTTP 500 from embedding server\n - server replied with `{\"error\":\"Service Unavailable\"}`"

}
},
"duration": "PT0.110083S",
"startedAt": "2024-12-10T15:49:04.995321Z",
Expand Down Expand Up @@ -270,6 +286,14 @@ Get a single batch.
},
"indexUids": {
"INDEX_NAME": 1
},
"progressTrace": { … },
"writeChannelCongestion": { … },
"internalDatabaseSizes": { … },
"embedderRequests": {
"total": 12,
"failed": 5,
"lastError": "runtime error: received internal error HTTP 500 from embedding server\n - server replied with `{\"error\":\"Service Unavailable\",\"text\":\"will_error\"}`"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"lastError": "runtime error: received internal error HTTP 500 from embedding server\n - server replied with `{\"error\":\"Service Unavailable\",\"text\":\"will_error\"}`"
"lastError": "runtime error: received internal error HTTP 500 from embedding server\n - server replied with `{\"error\":\"Service Unavailable\"}`"

}
},
"duration": "PT0.364788S",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ await client.GetTasksAsync(new TasksQuery { Statuses = new List<TaskInfoStatus>
```rust Rust
let mut query = TasksQuery::new(&client);
let tasks = query
.with_statuses(["failed", "canceled"])
.with_statuses(["failed"])
.execute()
.await
.unwrap();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,13 @@
curl \
-X GET 'MEILISEARCH_URL/tasks?statuses=failed,canceled'
```

```rust Rust
let mut query = TasksQuery::new(&client);
let tasks = query
.with_statuses(["failed", "canceled"])
.execute()
.await
.unwrap();
```
</CodeGroup>
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,12 @@ curl \
"primaryKey": "id"
}'
```

```rust Rust
let client = Client::new("http://localhost:7700", Some("DEFAULT_ADMIN_API_KEY"));
let task = client
.create_index("medical_records", Some("id"))
.await
.unwrap();
```
</CodeGroup>
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,12 @@
curl -X GET 'MEILISEARCH_URL/keys' \
-H 'Authorization: Bearer MASTER_KEY'
```

```rust Rust
let client = Client::new("http://localhost:7700", Some("MASTER_KEY"));
client
.get_keys()
.await
.unwrap();
```
</CodeGroup>
11 changes: 11 additions & 0 deletions snippets/samples/code_samples_basic_security_tutorial_search_1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,15 @@ curl \
-H 'Authorization: Bearer DEFAULT_SEARCH_API_KEY' \
--data-binary '{ "q": "appointments" }'
```

```rust Rust
let client = Client::new("http://localhost:7700", Some("DEFAULT_SEARCH_API_KEY"));
let index = client.index("medical_records");
index
.search()
.with_query("appointments")
.execute::<MedicalRecord>()
.await
.unwrap();
```
</CodeGroup>
10 changes: 10 additions & 0 deletions snippets/samples/code_samples_facet_search_1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,16 @@ var query = new SearchFacetsQuery()
await client.Index("books").FacetSearchAsync("genres", query);
```

```rust Rust
let res = client.index("books")
.facet_search("genres")
.with_facet_query("fiction")
.with_filter("rating > 3")
.execute()
.await
.unwrap();
```

```dart Dart
await client.index('books').facetSearch(
FacetSearchQuery(
Expand Down
14 changes: 14 additions & 0 deletions snippets/samples/code_samples_facet_search_2.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,20 @@ var newFaceting = new Faceting
await client.Index("books").UpdateFacetingAsync(newFaceting);
```

```rust Rust
let mut facet_sort_setting = BTreeMap::new();
facet_sort_setting.insert("genres".to_string(), FacetSortValue::Count);
let faceting = FacetingSettings {
max_values_per_facet: 100,
sort_facet_values_by: Some(facet_sort_setting),
};

let res = client.index("books")
.set_faceting(&faceting)
.await
.unwrap();
```

```dart Dart
await client.index('books').updateFaceting(
Faceting(
Expand Down
9 changes: 9 additions & 0 deletions snippets/samples/code_samples_facet_search_3.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ var query = new SearchFacetsQuery()
await client.Index("books").FacetSearchAsync("genres", query);
```

```rust Rust
let res = client.index("books")
.facet_search("genres")
.with_facet_query("c")
.execute()
.await
.unwrap();
```

```dart Dart
await client.index('books').facetSearch(
FacetSearchQuery(
Expand Down
4 changes: 4 additions & 0 deletions snippets/samples/code_samples_get_all_batches_1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,8 @@ $client->getBatches();
```ruby Ruby
client.batches
```

```go Go
client.GetBatches();
```
</CodeGroup>
4 changes: 4 additions & 0 deletions snippets/samples/code_samples_get_batch_1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,8 @@ $client->getBatch(BATCH_UID);
```ruby Ruby
client.batch(BATCH_UID)
```

```go Go
client.GetBatch(BATCH_UID);
```
</CodeGroup>
4 changes: 4 additions & 0 deletions snippets/samples/code_samples_get_embedders_1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@ curl \
```ruby Ruby
client.index('INDEX_NAME').embedders
```

```rust Rust
let embedders = index.get_embedders().await.unwrap();
```
</CodeGroup>
8 changes: 8 additions & 0 deletions snippets/samples/code_samples_get_facet_search_settings_1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,12 @@ client.index('INDEX_UID').facet_search_setting
```go Go
client.Index("books").GetFacetSearch()
```

```rust Rust
let facet_search: bool = client
.index(INDEX_UID)
.get_facet_search()
.await
.unwrap();
```
</CodeGroup>
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,12 @@ client.index('INDEX_UID').prefix_search
```go Go
client.Index("books").GetPrefixSearch()
```

```rust Rust
let prefix_search: PrefixSearchSettings = client
.index(INDEX_UID)
.get_prefix_search()
.await
.unwrap();
```
</CodeGroup>
8 changes: 8 additions & 0 deletions snippets/samples/code_samples_get_similar_post_1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,12 @@ client.Index("INDEX_NAME").SearchSimilarDocuments(&meilisearch.SimilarDocumentQu
Embedder: "default",
}, resp)
```

```rust Rust
let results = index
.similar_search("TARGET_DOCUMENT_ID", "EMBEDDER_NAME")
.execute()
.await
.unwrap();
```
</CodeGroup>
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ namespace Meilisearch_demo
```text Rust
// In your .toml file:
[dependencies]
meilisearch-sdk = "0.28.0"
meilisearch-sdk = "0.29.1"
# futures: because we want to block on futures
futures = "0.3"
# serde: required if you are going to use documents
Expand Down
3 changes: 3 additions & 0 deletions snippets/samples/code_samples_getting_started_faceting.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,11 @@ await client.Index("movies").UpdateFacetingAsync(faceting);
```

```rust Rust
let mut facet_sort_setting = BTreeMap::new();
facet_sort_setting.insert("*".to_string(), FacetSortValue::Count);
let mut faceting = FacetingSettings {
max_values_per_facet: 2,
sort_facet_values_by: Some(facet_sort_setting),
};

let task: TaskInfo = client
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,11 @@
curl \
-X GET 'MEILISEARCH_URL/indexes/INDEX_NAME/settings/searchable-attributes'
```

```rust Rust
let searchable_attributes: Vec<String> = index
.get_searchable_attributes()
.await
.unwrap();
```
</CodeGroup>
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,11 @@ curl \
"overview"
]'
```

```rust Rust
let task = index
.set_searchable_attributes(["title", "overview"])
.await
.unwrap();
```
</CodeGroup>
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@
curl \
-X GET 'MEILISEARCH_URL/tasks/TASK_UID'
```

```rust Rust
let task_status = index.get_task(&task).await.unwrap();
```
</CodeGroup>
8 changes: 8 additions & 0 deletions snippets/samples/code_samples_negative_search_1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,12 @@ client.index('movies').search('-escape')
```php PHP
$client->index('movies')->search('-escape');
```

```rust Rust
let results = index.search()
.with_query("-escape")
.execute()
.await
.unwrap();
```
</CodeGroup>
8 changes: 8 additions & 0 deletions snippets/samples/code_samples_negative_search_2.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,12 @@ client.index('movies').search('-"escape"')
```php PHP
$client->index('movies')->search('-"escape"');
```

```rust Rust
let results = index.search()
.with_query("-\"escape room\"")
.execute()
.await
.unwrap();
```
</CodeGroup>
16 changes: 16 additions & 0 deletions snippets/samples/code_samples_related_results_embedder_1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,20 @@ curl -X PATCH 'MEILISEARCH_URL/indexes/movies/settings'
}
}'
```

```rust Rust
let embedders = HashMap::from([(
String::from("movies-text"),
Embedder {
source: EmbedderSource::OpenAi,
api_key: Some(String::from("OPENAI_API_KEY")),
model: Some(String::from("text-embedding-3-small")),
document_template: Some(String::from("A movie titled '{{doc.title}}' released in {{ doc.release_date }}. The movie genres are: {{doc.genres}}. The story is about: {{doc.overview|truncatewords: 20}}")),
..Embedder::default()
}
)]);
movies.set_embedders(&embedders)
.await
.unwrap();
```
</CodeGroup>
9 changes: 9 additions & 0 deletions snippets/samples/code_samples_related_results_search_1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,13 @@ curl -X POST 'MEILISEARCH_URL/indexes/INDEX_NAME/search' \
}
}'
```

```rust Rust
let results = movies.search()
.with_query("batman")
.with_hybrid("EMBEDDER_NAME", 0.5)
.execute()
.await
.unwrap();
```
</CodeGroup>
7 changes: 7 additions & 0 deletions snippets/samples/code_samples_related_results_similar_1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,11 @@ curl \
"embedder": "EMBEDDER_NAME"
}'
```

```rust Rust
let results = movies.similar_search("192", "EMBEDDER_NAME")
.execute()
.await
.unwrap();
```
</CodeGroup>
4 changes: 4 additions & 0 deletions snippets/samples/code_samples_reset_embedders_1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@ curl \
```ruby Ruby
client.index('INDEX_NAME').reset_embedders
```

```rust Rust
index.reset_embedders().await.unwrap();
```
</CodeGroup>
Loading