Reindex data on the php

php client has functions for reindex data like ruby https://github.com/pgaertig/es-reindex/blob/master/es-reindex.rb
?

Nope, it doesn't currently. Sorry :pensive:

There are helpers for constructing scan/scroll iterators contributed by a community member, which would handle most of the complexity of reindexing...you'd just have to construct bulks to do the actual reindexing part.

If you (or anyone else!) wants to work on a reindexing helper, I'd be more than happy to merge it!

1 Like

This is solution https://github.com/pgaertig/es-reindex/blob/master/es-reindex.rb
is stable?

I have no idea to be honest, it's not part of the official Elasticsearch client code, so we don't maintain it or verify that it still works. I suspect it still works, since backwards compatibility breaks don't happen often...but you'd have to test it out to be sure :smile:

Both the official Python client and Perl client have reindex helpers, which are officially supported and maintained.

Can i make php client for reindex data?
Ou php client has necessary functions for this?

Yes, the PHP client can do it. A reindex API is just the combination of:

  • Scan/scroll API to get all your data
  • Bulk indexing to re-insert the data into a new index

The PHP client (and all other ES clients) have this functionality as independent APIs. Some clients, like python and perl, have a "helper" which wraps the two APIs together so you have to write less code. But they aren't doing anything special.

Reindexing is just taking a document and indexing it into a new index, using basic ES functionality.

1 Like

I see now that there's a reindex endpoint in the php API.
All seems clear except the :

`['body']   = (array) The search definition using the Query DSL and the prototype for the index request (Required)`

I want to change the mapping of some fields in the index (string->nr), can this method help me ?

1 Like