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] Invalid Subfield Document Created When Using DOT Notation #8748

Open
forestmvey opened this issue Jul 18, 2023 · 0 comments
Open

[BUG] Invalid Subfield Document Created When Using DOT Notation #8748

forestmvey opened this issue Jul 18, 2023 · 0 comments
Labels
bug Something isn't working distributed framework Search Search query, autocomplete ...etc

Comments

@forestmvey
Copy link

Describe the bug
When using DOT notation in a field while creating a document we get a document that doesn't match the mapping. Dynamic mapping is successful in matching the supplied field as a subfield, but document parsing fails to match this mapping.

To Reproduce
Steps to reproduce the behavior:

  1. Create a doc with a dot in a field name:
curl -X POST "localhost:9200/test/_doc/?pretty" -H 'Content-Type: application/json' -d '{ "account.number" : 42 }'
  1. Verify mapping created for document properly recognizes the account.number as a subfield:
curl -X GET "localhost:9200/test" -H 'Content-Type: application/json'
{
    "test": {
        "aliases": {},
        "mappings": {
            "properties": {
                "account": {
                    "properties": {
                        "number": {
                            "type": "long"
                        }
                    }
                }
            }
    ...
 }
  1. Query document and see that the original source value is used rather than subfield value:
    Query:
curl -X POST "localhost:9200/test/_search" -H 'Content-Type: application/json' -d '{"_source":{"includes":["*"]}}'
{
    ...,
    "hits": [
    {
       "_index": "test",
        "_id": "",
        "_score": 1.0,
        "_source": {
           "account.number": 42
       }
    }] 
}

Expected behavior
Document data should reflect mapping with account.number field as subfield. Expected output should look like:

{
    ...,
    "hits": [
    {
        "_index": "test2",
        "_id": "1",
        "_score": 1.0,
        "_source": {
            "account": {
                "number": 42
           }
         }
   }]
}

Plugins
opensearch-sql

Screenshots
N/A

Host/Environment (please complete the following information):

  • OS: MacOS
  • Version 13.4.1

Additional context
OpenSearch Commit: ca74aac1482718a864676e27707bb77b7c168e6f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working distributed framework Search Search query, autocomplete ...etc
Projects
Status: Later (6 months plus)
Development

No branches or pull requests

3 participants