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
5 changes: 5 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,11 @@ subprojects {
}
}
}

configurations.all {
exclude group: "org.slf4j", module: "slf4j-log4j12"
exclude group: "log4j", module: "log4j"
}
}

signing {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package org.openmbee.mms.elastic.services;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.search.ClearScrollRequest;
import org.elasticsearch.action.search.ClearScrollResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.elasticsearch.action.fieldcaps.FieldCapabilities;
import org.elasticsearch.action.fieldcaps.FieldCapabilitiesRequest;
import org.elasticsearch.action.fieldcaps.FieldCapabilitiesResponse;
Expand Down Expand Up @@ -37,7 +40,7 @@

@Service
public class ElasticSearchService implements SearchService {
private final Logger logger = LogManager.getLogger(getClass());
private final Logger logger = LoggerFactory.getLogger(getClass());

@Value("${elasticsearch.limit.result}")
protected int resultLimit;
Expand All @@ -46,6 +49,19 @@ public class ElasticSearchService implements SearchService {
protected RestHighLevelClient client;
protected NodeDAO nodeRepository;

protected ActionListener<ClearScrollResponse> listener = new ActionListener<>() {
@Override
public void onResponse(ClearScrollResponse clearScrollResponse) {
logger.debug("Cleared: " + clearScrollResponse.getNumFreed());
}

@Override
public void onFailure(Exception e) {
logger.error("Scroll clear failure: ");
logger.error(e.getMessage());
}
};

@Autowired
public void setRestHighLevelClient(@Qualifier("clientElastic") RestHighLevelClient client) {
this.client = client;
Expand Down Expand Up @@ -197,6 +213,12 @@ private List<ElementJson> performElasticQuery(Set<String> allNodeDocIds, SearchR

} while (scrollId != null && searchResponse.getHits().getHits() != null && searchResponse.getHits().getHits().length != 0);

if (scrollId != null) {
ClearScrollRequest clearScrollRequest = new ClearScrollRequest();
clearScrollRequest.addScrollId(scrollId);
client.clearScrollAsync(clearScrollRequest, RequestOptions.DEFAULT, listener);
}

return result;
}

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=4.0.5
version=4.0.6
group=org.openmbee.mms

springBootVersion=2.2.6.RELEASE
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.openmbee.mms.twc.config;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.openmbee.mms.twc.security.TwcAuthenticationFilter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
Expand All @@ -16,7 +16,7 @@
@EnableWebSecurity
@EnableTransactionManagement
public class TwcAuthSecurityConfig {
private static Logger logger = LogManager.getLogger(TwcAuthSecurityConfig.class);
private static Logger logger = LoggerFactory.getLogger(TwcAuthSecurityConfig.class);

public void setAuthConfig(HttpSecurity http) throws Exception {
http.addFilterBefore(twcAuthenticationFilter(), UsernamePasswordAuthenticationFilter.class);
Expand Down