Skip to content

[BUG]Query support on flat_object field with dotted sub field names is unreliable #11402

@ngnwn

Description

@ngnwn

Describe the bug
I have an index with a field of type “flat_object,” and the JSON object for that field contains dotted sub-field names. I’m attempting to apply a term query using the entire key and value but it doesn't work as expected

To Reproduce
Steps to reproduce the behavior:

  1. Create an index with mapping:
PUT /my-test-os-index
{
  "mappings": {
    "properties": {
      "transcript": {"type": "flat_object"}
    }
  }
}
  1. Index a single document
POST my-test-os-index/_doc
{
  "transcript": {
    "one": "FAILED",
    "two.one": "FAILED",
    "three": "FAILED"
  }
}
  1. Run a term query
POST my-test-os-index/_search
{
  "query": {
    "term": {"transcript.three": "FAILED"}
  }
}
  1. The results are empty

Expected behavior
We expect the one indexed document to be returned cause it matches the criteria

Plugins
I am using OpenSearch 2.9

Host/Environment (please complete the following information):
Using OS serverless

Additional context

POST my-test-os-index/_search
{
  "query": {
    "term": {"transcript.one": "FAILED"}
  }
}

This query retrieves the document making the results order dependent and unreliable

Metadata

Metadata

Assignees

Labels

SearchSearch query, autocomplete ...etcbugSomething isn't workingv2.12.0Issues and PRs related to version 2.12.0v3.0.0Issues and PRs related to version 3.0.0

Type

No type

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions