Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on save: index [datahub_rest_index__catalog-assets__objectfolder-even/] already exists #3

Open
NiklasBr opened this issue Mar 16, 2023 · 0 comments

Comments

@NiklasBr
Copy link

NiklasBr commented Mar 16, 2023

Pimcore 10.5.12, Datahub 1.5.2, CI Hub Bundle 2.0.1, PHP 8.1.15.

When saving a configuration we get the following error:

{
  "error": {
    "root_cause": [
      {
        "type": "resource_already_exists_exception",
        "reason": "index [datahub_rest_index__catalog-assets__objectfolder-even/xOj4qXzsRY-vhcP3z-Y1Sg] already exists",
        "index_uuid": "xOj4qXzsRY-vhcP3z-Y1Sg",
        "index": "datahub_rest_index__catalog-assets__objectfolder-even"
      }
    ],
    "type": "resource_already_exists_exception",
    "reason": "index [datahub_rest_index__catalog-assets__objectfolder-even/xOj4qXzsRY-vhcP3z-Y1Sg] already exists",
    "index_uuid": "xOj4qXzsRY-vhcP3z-Y1Sg",
    "index": "datahub_rest_index__catalog-assets__objectfolder-even"
  },
  "status": 400
}

It looks like the error is thrown in IndexManager::createOrUpdateIndex(string $indexName, array $mapping).

The datahub configuration looks like this:

pimcore_data_hub:
    configurations:
        catalog-assets:
            general:
                active: 'on'
                type: ciHub
                name: catalog-assets
                description: ''
                modificationDate: 1675333190
                path: null
                createDate: 1675332757
            deliverySettings:
                apikey: #redacted
            schema:
                assets:
                    allowOriginalImage: 'on'
                    thumbnails:
                        - galleryThumbnail
                dataObjectClasses:
# long config removed

ES in docker-compose.yaml looks like this:

  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:8.6.2
    container_name: eleasticsearch
    environment:
      - discovery.type=single-node
      - cluster.name=docker-cluster
      - bootstrap.memory_lock=true
      - ingest.geoip.downloader.enabled=false
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: 65536
        hard: 65536
    cap_add:
      - IPC_LOCK
    mem_limit: 1g
    volumes:
      - ./docker/elasticsearch/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
      - elasticsearch-data:/usr/share/elasticsearch/data
    ports:
      - "9200:9200"
      - "9300:9300"

The referenced elasticsearch.yml in the above snippet looks like this:

cluster:
  name: "docker-cluster"

network:
  host: 0.0.0.0

action:
    destructive_requires_name: false

xpack:
  security:
    enabled: false
    audit:
      enabled: false
    authc:
      anonymous:
        username: anonymous_user
        roles: role1, role2
        authz_exception: false
      token:
        enabled: true

And finally the simple_rest_adapter.yaml config file looks like this:

# Configuration for "SimpleRESTAdapterBundle"
simple_rest_adapter:
    index_name_prefix: datahub_rest_index
    es_hosts:
        - '%env(ELASTIC_SEARCH_PROTO)%://%env(ELASTIC_SEARCH_HOST)%:%env(ELASTIC_SEARCH_PORT)%'

    # Global Elasticsearch index settings.
    index_settings:

        # Defaults:
        number_of_shards: 5
        number_of_replicas: 0
        max_ngram_diff: 20
        analysis:
            analyzer:
                datahub_ngram_analyzer:
                    type: custom
                    tokenizer: datahub_ngram_tokenizer
                    filter:
                        - lowercase
                datahub_whitespace_analyzer:
                    type: custom
                    tokenizer: datahub_whitespace_tokenizer
                    filter:
                        - lowercase
            normalizer:
                lowercase:
                    type: custom
                    filter:
                        - lowercase
            tokenizer:
                datahub_ngram_tokenizer:
                    type: ngram # ES8 all lowercase
                    min_gram: 2
                    max_gram: 20
                    token_chars:
                        - letter
                        - digit
                datahub_whitespace_tokenizer:
                    type: whitespace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant