Skip to content

Commit 59a4318

Browse files
committed
Reindex: Clean up docs around multi-index
We have an example in `reindex`'s docs about copying from many indices at once. It doesn't work at the moment because we only allow a single type per index. We didn't notice it in the docs tests because those tests didn't copy any documents. This change: 1. Adds documents to the docs tests to fully exercise the snippet. 2. Fixes the example by moving all copied documents to the same type. 3. Moves the note about id collisions and expands on it because it is even more likely than before. Closes #35150
1 parent fd82813 commit 59a4318

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

docs/reference/docs/reindex.asciidoc

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -164,13 +164,7 @@ POST _reindex
164164

165165
`index` and `type` in `source` can both be lists, allowing you to copy from
166166
lots of sources in one request. This will copy documents from the `_doc` and
167-
`post` types in the `twitter` and `blog` index. The copied documents would include the
168-
`post` type in the `twitter` index and the `_doc` type in the `blog` index. For more
169-
specific parameters, you can use `query`.
170-
171-
The Reindex API makes no effort to handle ID collisions. For such issues, the target index
172-
will remain valid, but it's not easy to predict which document will survive because
173-
the iteration order isn't well defined.
167+
`post` types in the `twitter` and `blog` indices.
174168

175169
[source,js]
176170
--------------------------------------------------
@@ -181,12 +175,19 @@ POST _reindex
181175
"type": ["_doc", "post"]
182176
},
183177
"dest": {
184-
"index": "all_together"
178+
"index": "all_together",
179+
"type": "_doc"
185180
}
186181
}
187182
--------------------------------------------------
188183
// CONSOLE
189-
// TEST[s/^/PUT twitter\nPUT blog\n/]
184+
// TEST[setup:twitter]
185+
// TEST[s/^/PUT blog\/post\/post1?refresh\n{"test": "foo"}\n/]
186+
187+
NOTE: The Reindex API makes no effort to handle ID collisions so the last
188+
document written will "win" but the order isn't usually predictable so it is
189+
not a good idea to rely on this behavior. Instead, make sure that IDs are unique
190+
using a script.
190191

191192
It's also possible to limit the number of processed documents by setting
192193
`size`. This will only copy a single document from `twitter` to

0 commit comments

Comments
 (0)