Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -1185,6 +1185,9 @@ public Engine.GetResult get(Engine.Get get) {
if (mappingLookup.hasMappings() == false) {
return GetResult.NOT_EXISTS;
}
if (indexSettings.getIndexVersionCreated().isLegacyIndexVersion()) {
throw new IllegalStateException("get operations not allowed on a legacy index");
}
return getEngine().get(get, mappingLookup, mapperService.documentParser(), this::wrapSearcher);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.elasticsearch.client.Request;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.Response;
import org.elasticsearch.client.ResponseException;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.client.core.ShardsAcknowledgedResponse;
Expand Down Expand Up @@ -49,6 +50,7 @@
import java.util.stream.Collectors;

import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThan;
Expand Down Expand Up @@ -455,6 +457,12 @@ private void assertDocs(
assertEquals(randomType, typeField.getValue());
}
}

assertThat(
expectThrows(ResponseException.class, () -> client().performRequest(new Request("GET", "/" + index + "/_doc/" + id)))
.getMessage(),
containsString("get operations not allowed on a legacy index")
);
}
}

Expand Down