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

[BUG] No hits for keys following an array in a flat_object #13698

Open
marko-metaps opened this issue May 16, 2024 · 1 comment
Open

[BUG] No hits for keys following an array in a flat_object #13698

marko-metaps opened this issue May 16, 2024 · 1 comment
Labels
bug Something isn't working Other untriaged

Comments

@marko-metaps
Copy link

marko-metaps commented May 16, 2024

Describe the bug

When using the flat_object type, keys that appear after an array within the object do not return any hits in search queries

Related component

Other

To Reproduce

  1. create an index:
curl -X PUT "$OS_HOST/$INDEX_NAME" -H 'Content-Type: application/json' -d '{
    "mappings": {
      "properties": {
        "data": {
          "type": "object",
          "properties": {
            "detail": {
              "type": "flat_object"
            }
          }
        }
      }
    }
  }'
  1. Add data
curl -X POST "$OS_HOST/$INDEX_NAME/_doc/1" -H 'Content-Type: application/json' -d '{
    "data": {
      "detail": {
        "val1": "val1",
        "array1": [
          {
            "key3": "value5",
            "key4": "value6"
          },
          {
            "key3": "value7",
            "key4": "value8"
          }
        ],
        "val2": "val2"
      }
    }
  }'
  1. Query the data:
curl -X GET "$OS_HOST/$INDEX_NAME/_search" -H 'Content-Type: application/json' -d '{
    "query": {
      "match": {
        "data.detail.val2": "val2"
      }
    }
  }'
  1. It retrieves 0 hits, although searching the value before the array works fine.
curl -X GET "$OS_HOST/$INDEX_NAME/_search" -H 'Content-Type: application/json' -d '{
    "query": {
      "match": {
        "data.detail.val1": "val1"
      }
    }
  }'

Expected behavior

Query should return matching values, despite the structure of the flat_object.

Additional Details

Plugins
No plugins enabled

Screenshots
Screenshot 2024-05-16 at 11 30 05

Host/Environment (please complete the following information):

  • OS: Mac OS Sonoma 14.1.1
  • Version 3.0.0-SNAPSHOT

Additional context
Add any other context about the problem here.

@marko-metaps marko-metaps added bug Something isn't working untriaged labels May 16, 2024
@github-actions github-actions bot added the Other label May 16, 2024
@dblock
Copy link
Member

dblock commented May 16, 2024

Looks like a legit problem. Want to turn this into a (failing) YAML REST test?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Other untriaged
Projects
None yet
Development

No branches or pull requests

2 participants