-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Closed
Labels
Description
This issue was originated from #36988 . When using the high-level REST client to get/index/update documents, slashes in ids can cause problems. This has to do with the logic that encodes each url part separately and then puts the result together in RequestConverters. The following test fails while I think it should succeed. What I think happens at the moment is that the document gets indexed with a different id than the one provided.
public void testIdWithSlashes() throws IOException {
IndexRequest indexRequest = new IndexRequest("dev_product");
indexRequest.id("/sku/test.com/48923AQ3");
indexRequest.source("field", "value");
IndexResponse indexResponse = highLevelClient().index(indexRequest, RequestOptions.DEFAULT);
assertEquals("/sku/test.com/48923AQ3", indexResponse.getId());
GetResponse getResponse = highLevelClient()
.get(new GetRequest("dev_product", "/sku/test.com/48923AQ3"), RequestOptions.DEFAULT);
assertTrue(getResponse.isExists());
}