Skip to content

Commit

Permalink
Fix system index compatibility with v1 templates (#658)
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Widdis <widdis@gmail.com>
(cherry picked from commit 4888ab2)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
github-actions[bot] committed Jul 31, 2024
1 parent 7ca3064 commit 8544976
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.opensearch.client.Client;
import org.opensearch.cluster.service.ClusterService;
import org.opensearch.common.xcontent.LoggingDeprecationHandler;
import org.opensearch.core.xcontent.MediaType;
import org.opensearch.core.xcontent.NamedXContentRegistry;
import org.opensearch.core.xcontent.ToXContent;
import org.opensearch.common.xcontent.XContentFactory;
Expand Down Expand Up @@ -82,7 +83,10 @@ void createLockIndex(ActionListener<Boolean> listener) {
if (lockIndexExist()) {
listener.onResponse(true);
} else {
final CreateIndexRequest request = new CreateIndexRequest(LOCK_INDEX_NAME).mapping(lockMapping());
final CreateIndexRequest request = new CreateIndexRequest(LOCK_INDEX_NAME).mapping(
lockMapping(),
(MediaType) XContentType.JSON
);
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 @@ -30,6 +30,7 @@
import org.opensearch.core.xcontent.XContentParser;
import org.opensearch.common.xcontent.XContentType;
import org.opensearch.extensions.action.ExtensionProxyAction;
import org.opensearch.core.xcontent.MediaType;
import org.opensearch.core.xcontent.NamedXContentRegistry;
import org.opensearch.common.xcontent.LoggingDeprecationHandler;
import org.opensearch.index.IndexNotFoundException;
Expand Down Expand Up @@ -293,7 +294,10 @@ void createJobDetailsIndex(ActionListener<Boolean> listener) {
if (jobDetailsIndexExist()) {
listener.onResponse(true);
} else {
CreateIndexRequest request = new CreateIndexRequest(JOB_DETAILS_INDEX_NAME).mapping(jobDetailsMapping());
CreateIndexRequest request = new CreateIndexRequest(JOB_DETAILS_INDEX_NAME).mapping(
jobDetailsMapping(),

Check warning on line 298 in src/main/java/org/opensearch/jobscheduler/utils/JobDetailsService.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/opensearch/jobscheduler/utils/JobDetailsService.java#L297-L298

Added lines #L297 - L298 were not covered by tests
(MediaType) XContentType.JSON
);
client.admin()
.indices()
.create(request, ActionListener.wrap(response -> listener.onResponse(response.isAcknowledged()), exception -> {
Expand Down

0 comments on commit 8544976

Please sign in to comment.