opensearch-project / opensearch-project/OpenSearch

[BUG] Resolve Indices API: Doesn't throw Index not found exception for certain scenarios, doesn't support `_all`

Open
#3,941 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Indexing & Search
Dominant language
Java
Stars
13.7k
Forks
3k
Avg merge
2d 23h
Merged PRs (30d)
108

Description

Describe the bug

  1. Resolve API doesn't throw index not found exception
    curl -XGET https://localhost:9200/_resolve/index/random?ignore_unavailable=true&allow_no_indices=false -u 'admin:admin' --insecure empty results are returned

    however for request with random*
    curl -XGET https://localhost:9200/_resolve/index/random*?ignore_unavailable=true&allow_no_indices=false -u 'admin:admin' --insecure throws index_not_found_exception

  2. Resolve with _all target returns empty results.

To Reproduce
Steps to reproduce the behavior:

  1. Install latest OpenSearch and start local cluster. Follow instructions here

  2. Make sure indices which starts with name random doesn't exist.
    curl -XGET https://localhost:9200/random* -u 'admin:admin' --insecure should return empty.

  3. a. Call resolve API with *
    curl -XGET https://localhost:9200/_resolve/index/random*?ignore_unavailable=true&allow_no_indices=false -u 'admin:admin' --insecure
    b. Call resolve API without *
    curl -XGET https://localhost:9200/_resolve/index/random?ignore_unavailable=true&allow_no_indices=false -u 'admin:admin' --insecure

  4. Reproduce _all
    a. Create an Index

    curl --location --request PUT 'http://localhost:9200/test-index' \
    --header 'Content-Type: application/json' \
    --data-raw '{
      "settings": {
        "index": {
          "number_of_shards": 2,
          "number_of_replicas": 1
        }
      },
      "mappings": {
        "properties": {
          "age": {
            "type": "integer"
          }
        }
      },
      "aliases": {
        "sample-alias1": {}
      }
    }'
    

    b. Now try to resolve all indices using target as _all

    curl -XGET https://localhost:9200/_resolve/index/_all -u 'admin:admin' --insecure;
    

Expected behavior

  1. Either both requests throw exception or neither of the requests throw exception to be consistent.
  2. It should resolve all indices.

Host/Environment (please complete the following information):

  • OS: Linux
  • Version: 2.1.x

Additional context

  • GetIndex API behavior
    • With wildcard (*)
      - Throws exception when allow_no_indices=false , ignore_unavailable option doesn’t matter.
    • Without wildcard
      - Throws exception if either of the options (allow_no_indices and ignore_unavailable ) are false.
  • ResolveIndex API behavior
    • With wildcard (*)
      - Same behavior as GetIndex API
    • Without wildcard
      - Doesn't throw exception for any combination of allow_no_indices and ignore_unavailable. This is unlike GetIndex API.
  • Also couldn't find documentation for resolve API here.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the two cases with the provided curl commands on OpenSearch 2.1.x, then compare Resolve Index API behavior with Get Index API for wildcard and non-wildcard targets. Trace the Resolve Index API entry point and its handling of allow_no_indices, ignore_unavailable, and _all; done means consistent missing-index behavior and resolution of all indices.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend, search
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.