Thetech Guy
Thetech Guy

Reputation: 1

OpenSearch Custom Docker Installation- Cannot create index

I'm trying to do a pretty basic, not-so-secure config of OpenSearch w/ Docker, which still seems to be blocking index creation

OpenSearch Config settings (Ubuntu 20.04 base)

Configure OpenSearch (in docker)

RUN mkdir -p /app/opensearch-2.17.0/config/certs && \
    echo "plugins.security.ssl.http.enabled: false" >> /app/opensearch-2.17.0/config/opensearch.yml && \
    echo "network.host: 0.0.0.0" >> /app/opensearch-2.17.0/config/opensearch.yml && \
    echo "discovery.type: single-node" >> /app/opensearch-2.17.0/config/opensearch.yml && \
    echo "plugins.security.ssl.transport.enabled: false" >> /app/opensearch-2.17.0/config/opensearch.yml && \
    echo "action.auto_create_index: true" >> /app/opensearch-2.17.0/config/opensearch.yml && \
    echo "cluster.blocks.read_only: false" >> /app/opensearch-2.17.0/config/opensearch.yml && \
    chown -R opensearch:opensearch /app/opensearch-2.17.0/config

Example query (w/ opensearchpy)

# Set up OpenSearch

client = OpenSearch(
    hosts=[{'host': host, 'port': port, 'scheme': 'http'}],
    http_compress=True,  # enables gzip compression for request bodies
    http_auth=auth,
    # use_ssl=True,
    use_ssl=False,
    verify_certs=False,
    ssl_assert_hostname=False,
    ssl_show_warn=False
)

index_name = "example-index"


if not client.indices.exists(index=index_name):
    print(f"The index '{index_name}' does not exist. Creating the index.")
    # Load the index mapping from a file
    with open("search_configuration/index_mapping.json", "r") as file:
        client.indices.create(index=index_name, body=json.load(file))

Error Message:

opensearchpy.exceptions.authorizationexception: authorizationexception(403, 'index_create_block_exception', 'blocked by: [forbidden/10/cluster create-index blocked (api)];')

I tried updating the size of the block to 4GB, delete any initial cache in JVM, but that didn't seem to work either. But anyhow this is the first time I try to even create an index in a brand new installation. Not sure what is happening.

Upvotes: 0

Views: 16

Answers (0)

Related Questions