Skip to content
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
9 changes: 9 additions & 0 deletions .code-samples.meilisearch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -515,3 +515,12 @@ distinct_attribute_guide_distinct_parameter_1: |-
client.index('products').search('white shirt', {
distinct: 'sku'
})
export_post_1: |-
client.export({
url: "TARGET_INSTANCE_URL",
indexes: {
"*": {
"overrideSettings": true
}
}
})
18 changes: 18 additions & 0 deletions lib/meilisearch/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,24 @@ def batch(batch_uid)
http_get "/batches/#{batch_uid}"
end

### EXPORT

# Migrate between instances with the /export route
#
# @see https://www.meilisearch.com/docs/reference/api/export Meilisearch API reference
# @param export_options [Hash{Symbol => Object}] the export options of which the required are
# - +:url+ +String+ the target instance’s URL address
# - +:api_key+ +String+ an API key with full admin access to the target instance
# - +:payload_size+ +String+ a string specifying the payload size in a human-readable format
# - +:indexes+ +Hash+ A set of patterns matching the indexes you want to export. Defaults to all indexes in the origin instance
# @return [Models::Task] the async task that is creating the export
Comment thread
Nymuxyzo marked this conversation as resolved.
def export(export_options)
body = Utils.transform_attributes(export_options)

response = http_post '/export', body
Models::Task.new(response, task_endpoint)
end

### EXPERIMENTAL FEATURES

def experimental_features
Expand Down
9 changes: 9 additions & 0 deletions spec/meilisearch/client/exports_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# frozen_string_literal: true

RSpec.describe 'Meilisearch::Client - Export' do
it 'creates a new export' do
task = client.export({ url: 'localhost:7701', indexes: { '*': { overrideSettings: true } } })

expect(task.type).to eq('export')
end
end