<commit_before>package io.searchbox.indices;

import io.searchbox.action.GenericResultAbstractAction;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;

/**
 * @author <NAME>
 * @author <NAME>
 */
public class CreateIndex extends GenericResultAbstractAction {

    private boolean isCreateOp = false;

    protected CreateIndex(Builder builder) {
        super(builder);

        this.indexName = builder.index;
        if (builder.settings != null) {
            this.payload = builder.settings;
        } else {
            this.payload = new Object();
            this.isCreateOp = true;
        }
        setURI(buildURI());
    }

    @Override
    public String getRestMethodName() {
        return isCreateOp ? "PUT" : "POST";
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder()
                .appendSuper(super.hashCode())
                .append(isCreateOp)
                .toHashCode();
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (obj == this) {
            return true;
        }
        if (obj.getClass() != getClass()) {
            return false;
        }

        CreateIndex rhs = (CreateIndex) obj;
        return new EqualsBuilder()
                .appendSuper(super.equals(obj))
                .append(isCreateOp, rhs.isCreateOp)
                .isEquals();
    }

    public static class Builder extends GenericResultAbstractAction.Builder<CreateIndex, Builder> {
        private Object settings = null;
        private String index;

        public Builder(String index) {
            this.index = index;
        }

        public Builder settings(Object settings) {
            this.settings = settings;
            return this;
        }

        @Override
        public CreateIndex build() {
            return new CreateIndex(this);
        }
    }

}
<commit_msg>GH-415 Change CreateIndex method to PUT<commit_after>package io.searchbox.indices;

import io.searchbox.action.GenericResultAbstractAction;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;

/**
 * @author <NAME>
 * @author <NAME>
 */
public class CreateIndex extends GenericResultAbstractAction {

    private boolean isCreateOp = false;

    protected CreateIndex(Builder builder) {
        super(builder);

        this.indexName = builder.index;
        if (builder.settings != null) {
            this.payload = builder.settings;
        } else {
            this.payload = new Object();
            this.isCreateOp = true;
        }
        setURI(buildURI());
    }

    @Override
    public String getRestMethodName() {
        return "PUT";
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder()
                .appendSuper(super.hashCode())
                .append(isCreateOp)
                .toHashCode();
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (obj == this) {
            return true;
        }
        if (obj.getClass() != getClass()) {
            return false;
        }

        CreateIndex rhs = (CreateIndex) obj;
        return new EqualsBuilder()
                .appendSuper(super.equals(obj))
                .append(isCreateOp, rhs.isCreateOp)
                .isEquals();
    }

    public static class Builder extends GenericResultAbstractAction.Builder<CreateIndex, Builder> {
        private Object settings = null;
        private String index;

        public Builder(String index) {
            this.index = index;
        }

        public Builder settings(Object settings) {
            this.settings = settings;
            return this;
        }

        @Override
        public CreateIndex build() {
            return new CreateIndex(this);
        }
    }

}

{'fraction_non_alphanumeric': 0.09587317564167086, 'fraction_numerical': 0.0017614494212380473, 'mean_word_length': 1.8535534816941852, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '2403375', 'n_tokens_mistral': 1053, 'n_tokens_neox': 1017, 'n_words': 247}