Skip to content

Commit

Permalink
Removes usage of mapping types (#155)
Browse files Browse the repository at this point in the history
Signed-off-by: Drew Baugher <[email protected]>
  • Loading branch information
dbbaughe authored Mar 26, 2022
1 parent 6189414 commit 6e624d5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import com.github.jengelman.gradle.plugins.shadow.ShadowPlugin

buildscript {
ext {
opensearch_version = System.getProperty("opensearch.version", "2.0.0-SNAPSHOT")
opensearch_version = System.getProperty("opensearch.version", "2.0.0-alpha1-SNAPSHOT")
}

repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@

public final class LockService {
private static final Logger logger = LogManager.getLogger(LockService.class);
/**
* This should go away starting ES 7. We use "_doc" for future compatibility as described here:
* https://www.elastic.co/guide/en/elasticsearch/reference/6.x/removal-of-types.html#_schedule_for_removal_of_mapping_types
*/
private static final String MAPPING_TYPE = "_doc";
private static final String LOCK_INDEX_NAME = ".opendistro-job-scheduler-lock";

private final Client client;
Expand Down Expand Up @@ -82,8 +77,7 @@ void createLockIndex(ActionListener<Boolean> listener) {
if (lockIndexExist()) {
listener.onResponse(true);
} else {
final CreateIndexRequest request = new CreateIndexRequest(LOCK_INDEX_NAME)
.mapping(MAPPING_TYPE, lockMapping(), XContentType.JSON);
final CreateIndexRequest request = new CreateIndexRequest(LOCK_INDEX_NAME).mapping(lockMapping());
client.admin().indices().create(request, ActionListener.wrap(
response -> listener.onResponse(response.isAcknowledged()),
exception -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ private Engine.Index getIndexOperation() {
"id_field",
new BytesRef(docId.getBytes(Charset.defaultCharset()), 0, docId.getBytes(Charset.defaultCharset()).length)
);
ParsedDocument parsedDocument = new ParsedDocument(null, null, docId, "_doc", null, docs, source, null, null);
ParsedDocument parsedDocument = new ParsedDocument(null, null, docId, null, docs, source, null, null);

return new Engine.Index(uid, primaryTerm, parsedDocument);
}
Expand All @@ -293,7 +293,7 @@ private Engine.Delete getDeleteOperation(String docId) {
"id_field",
new BytesRef(docId.getBytes(Charset.defaultCharset()), 0, docId.getBytes(Charset.defaultCharset()).length)
);
return new Engine.Delete("_doc", docId, uid, 1L);
return new Engine.Delete(docId, uid, 1L);
}

private BytesReference getTestJsonSource() {
Expand Down

0 comments on commit 6e624d5

Please sign in to comment.