Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump to OpenSearch 2.6 #351

Merged
merged 4 commits into from
Feb 21, 2023
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
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 org.opensearch.gradle.test.RestIntegTestTask

buildscript {
ext {
opensearch_version = System.getProperty("opensearch.version", "2.5.0-SNAPSHOT")
opensearch_version = System.getProperty("opensearch.version", "2.6.0-SNAPSHOT")
isSnapshot = "true" == System.getProperty("build.snapshot", "true")
buildVersionQualifier = System.getProperty("build.version_qualifier", "")
version_tokens = opensearch_version.tokenize('-')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
package org.opensearch.securityanalytics.action;

import com.carrotsearch.hppc.cursors.ObjectObjectCursor;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.opensearch.Version;
import org.opensearch.action.ActionResponse;
import org.opensearch.cluster.metadata.MappingMetadata;
Expand All @@ -13,14 +15,18 @@
import org.opensearch.common.collect.ImmutableOpenMap;
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.io.stream.StreamOutput;
import org.opensearch.common.xcontent.ToXContent;
import org.opensearch.common.xcontent.ToXContentObject;
import org.opensearch.common.xcontent.XContentBuilder;
import org.opensearch.common.xcontent.XContentFactory;
import org.opensearch.index.mapper.MapperService;

import java.io.IOException;

public class GetIndexMappingsResponse extends ActionResponse implements ToXContentObject {

private Logger logger = LogManager.getLogger(GetIndexMappingsResponse.class);

private static final ParseField MAPPINGS = new ParseField("mappings");

private final ImmutableOpenMap<String, MappingMetadata> mappings;
Expand Down Expand Up @@ -99,7 +105,12 @@ public ImmutableOpenMap<String, MappingMetadata> getMappings() {

@Override
public String toString() {
return Strings.toString(this);
try {
return Strings.toString(this.toXContent(XContentFactory.jsonBuilder(), ToXContent.EMPTY_PARAMS));
} catch (IOException e) {
logger.error(e.getMessage());
return "";
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,28 @@
*/
package org.opensearch.securityanalytics.action;

import com.carrotsearch.hppc.cursors.ObjectObjectCursor;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import org.opensearch.Version;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.opensearch.action.ActionResponse;
import org.opensearch.cluster.metadata.MappingMetadata;
import org.opensearch.common.ParseField;
import org.opensearch.common.Strings;
import org.opensearch.common.bytes.BytesReference;
import org.opensearch.common.collect.ImmutableOpenMap;
import org.opensearch.common.compress.CompressedXContent;
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.io.stream.StreamOutput;
import org.opensearch.common.xcontent.ToXContent;
import org.opensearch.common.xcontent.ToXContentObject;
import org.opensearch.common.xcontent.XContentBuilder;
import org.opensearch.common.xcontent.XContentFactory;
import org.opensearch.index.mapper.MapperService;
import org.opensearch.securityanalytics.mapper.MapperUtils;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;

public class GetMappingsViewResponse extends ActionResponse implements ToXContentObject {

private Logger logger = LogManager.getLogger(GetMappingsViewResponse.class);

public static final String UNMAPPED_INDEX_FIELDS = "unmapped_index_fields";
public static final String UNMAPPED_FIELD_ALIASES = "unmapped_field_aliases";

Expand Down Expand Up @@ -133,7 +131,12 @@ public List<String> getUnmappedIndexFields() {

@Override
public String toString() {
return Strings.toString(this);
try {
return Strings.toString(this.toXContent(XContentFactory.jsonBuilder(), ToXContent.EMPTY_PARAMS));
} catch (IOException e) {
logger.error(e.getMessage());
return "";
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,26 @@
*/
package org.opensearch.securityanalytics.action;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.opensearch.action.ActionResponse;
import org.opensearch.common.Strings;
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.io.stream.StreamOutput;
import org.opensearch.common.xcontent.ToXContent;
import org.opensearch.common.xcontent.ToXContentObject;
import org.opensearch.common.xcontent.XContentBuilder;
import org.opensearch.securityanalytics.mapper.MapperUtils;
import org.opensearch.common.xcontent.XContentFactory;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

public class ValidateRulesResponse extends ActionResponse implements ToXContentObject {

private Logger logger = LogManager.getLogger(ValidateRulesResponse.class);

public static final String NONAPPLICABLE_FIELDS = "nonapplicable_fields";

List<String> nonapplicableFields;
Expand Down Expand Up @@ -66,7 +71,12 @@ public List<String> getNonapplicableFields() {

@Override
public String toString() {
return Strings.toString(this);
try {
return Strings.toString(this.toXContent(XContentFactory.jsonBuilder(), ToXContent.EMPTY_PARAMS));
} catch (IOException e) {
logger.error(e.getMessage());
return "";
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.lucene.util.SetOnce;
import org.opensearch.common.SetOnce;
import org.opensearch.OpenSearchStatusException;
import org.opensearch.action.ActionListener;
import org.opensearch.action.ActionRunnable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.lucene.search.join.ScoreMode;
import org.apache.lucene.util.SetOnce;
import org.opensearch.common.SetOnce;
import org.opensearch.OpenSearchStatusException;
import org.opensearch.action.ActionListener;
import org.opensearch.action.ActionRunnable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ protected String createTestIndex(String index, String mapping, Settings settings

protected String createTestIndex(RestClient client, String index, String mapping, Settings settings) throws IOException {
Request request = new Request("PUT", "/" + index);
String entity = "{\"settings\": " + Strings.toString(settings);
String entity = "{\"settings\": " + Strings.toString(
settings.toXContent(XContentFactory.jsonBuilder(), ToXContent.EMPTY_PARAMS));
if (mapping != null) {
entity = entity + ",\"mappings\" : {" + mapping + "}";
}
Expand Down