<commit_before>/*
 * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
 * or more contributor license agreements. Licensed under the Elastic License;
 * you may not use this file except in compliance with the Elastic License.
 */
package org.elasticsearch.upgrades;

import org.elasticsearch.Version;
import org.elasticsearch.client.Request;
import org.elasticsearch.client.Response;
import org.elasticsearch.test.rest.yaml.ObjectPath;
import org.elasticsearch.common.Booleans;
import org.hamcrest.Matchers;
import org.junit.Before;

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

import static org.hamcrest.Matchers.hasSize;

public class IndexAuditUpgradeIT extends AbstractUpgradeTestCase {
    private Version minVersionInCluster;

    @Before
    public void findMinVersionInCluster() throws IOException {
        if (CLUSTER_TYPE == ClusterType.UPGRADED) {
            // cannot use minVersion in cluster as we are upgraded on all nodes,
            // BUT we can check the version created on the index
            Response response = client().performRequest("GET", "/.security_audit_log*/_settings/index.version.created",
                    Collections.singletonMap("flat_settings", "true"));
            Map<String, Object> responseMap = entityAsMap(response);
            logger.info("get settings response {}", responseMap);
            for (Map.Entry<String, Object> entry : responseMap.entrySet()) {
                Map<String, Object> indexEntry = (Map<String, Object>) entry.getValue();
                Map<String, Object> indexSettings = (Map<String, Object>) indexEntry.get("settings");
                String versionCreated = (String) indexSettings.get("index.version.created");
                if (versionCreated != null) {
                    Version indexVersionCreated = Version.fromId(Integer.valueOf(versionCreated));
                    if (minVersionInCluster == null || indexVersionCreated.before(minVersionInCluster)) {
                        minVersionInCluster = indexVersionCreated;
                    }
                }<commit_msg>Fix compilation error introduced by #32339<commit_after>/*
 * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
 * or more contributor license agreements. Licensed under the Elastic License;
 * you may not use this file except in compliance with the Elastic License.
 */
package org.elasticsearch.upgrades;

import org.elasticsearch.Version;
import org.elasticsearch.client.Request;
import org.elasticsearch.client.Response;
import org.elasticsearch.test.rest.yaml.ObjectPath;
import org.elasticsearch.common.Booleans;
import org.hamcrest.Matchers;
import org.junit.Before;

import java.io.IOException;
import java.util.Collections;
import java.util.List;
import java.util.Map;

import static org.hamcrest.Matchers.hasSize;

public class IndexAuditUpgradeIT extends AbstractUpgradeTestCase {
    private Version minVersionInCluster;

    @Before
    public void findMinVersionInCluster() throws IOException {
        if (CLUSTER_TYPE == ClusterType.UPGRADED) {
            // cannot use minVersion in cluster as we are upgraded on all nodes,
            // BUT we can check the version created on the index
            Response response = client().performRequest("GET", "/.security_audit_log*/_settings/index.version.created",
                    Collections.singletonMap("flat_settings", "true"));
            Map<String, Object> responseMap = entityAsMap(response);
            logger.info("get settings response {}", responseMap);
            for (Map.Entry<String, Object> entry : responseMap.entrySet()) {
                Map<String, Object> indexEntry = (Map<String, Object>) entry.getValue();
                Map<String, Object> indexSettings = (Map<String, Object>) indexEntry.get("settings");
                String versionCreated = (String) indexSettings.get("index.version.created");
                if (versionCreated != null) {
                    Version indexVersionCreated = Version.fromId(Integer.valueOf(versionCreated));
                    if (minVersionInCluster == null || indexVersionCreated.before(minVersionInCluster)) {
                        minVersionInCluster = indexVersionCreated;
                    }
                }
{'fraction_non_alphanumeric': 0.09351011863224006, 'fraction_numerical': 0.0011630611770179111, 'mean_word_length': 3.0952380952380953, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6748467', 'n_tokens_mistral': 1071, 'n_tokens_neox': 1058, 'n_words': 299}