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 · 2 comments
Open

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

marko-metaps opened this issue May 16, 2024 · 2 comments
Labels
bug Something isn't working Other Search Search query, autocomplete ...etc

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?

@andrross andrross added the Search Search query, autocomplete ...etc label Jun 12, 2024
@andrross
Copy link
Member

[Triage - attendees 1 2 3 4 5]

Thanks for filing. Looks like a bug with clear reproduction steps.

@getsaurabh02 getsaurabh02 moved this from 🆕 New to Later (6 months plus) in Search Project Board Aug 15, 2024
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 Search Search query, autocomplete ...etc
Projects
Status: Later (6 months plus)
Development

No branches or pull requests

3 participants