Skip to content

Commit

Permalink
Bump to OpenSearch 2.6 (#351)
Browse files Browse the repository at this point in the history
Signed-off-by: Ashish Agrawal <ashisagr@amazon.com>
  • Loading branch information
lezzago authored Feb 21, 2023
1 parent 3444c39 commit 591662c
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 26 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 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

0 comments on commit 591662c

Please sign in to comment.