Skip to content

"object field starting or ending with a [.] makes object resolution ambiguous" does not appear to be accurate for all inputs #28948

@danlevy1

Description

@danlevy1

#Elasticsearch version: 6.2.1

Plugins installed: None

JVM version: 1.8.0_131

OS version: MacOS 10.13

I am running across a few test cases where the following error is not making sense to me.

The first example includes a [.] in front of foo. In this case, there is an error that states that there cannot be a [.] at the beginning of the object field:

Input:

curl -XPUT 'localhost:9200/test/test/1?pretty' -H 'Content-Type: application/json' -d' {
    ".foo" : {
        "foo" : {
            "bar" : 123 
        }
    } 
}
'

Output (Error):

{
  "error" : {
    "root_cause" : [
      {
        "type" : "mapper_parsing_exception",
        "reason" : "failed to parse"
      }
    ],
    "type" : "mapper_parsing_exception",
    "reason" : "failed to parse",
    "caused_by" : {
      "type" : "illegal_argument_exception",
      "reason" : "object field starting or ending with a [.] makes object resolution ambiguous: [.foo]"
    }
  },
  "status" : 400
}

This makes sense according to the error.

The second example includes a [.] after foo. In this case, there is no error.

Input:

curl -XPUT 'localhost:9200/test/test/1?pretty' -H 'Content-Type: application/json' -d' {
    "foo." : {
        "foo" : {
            "bar" : 123 
        }
    } 
}
'

Output (Success):

{
  "_index" : "test",
  "_type" : "test",
  "_id" : "1",
  "_version" : 9,
  "result" : "updated",
  "_shards" : {
    "total" : 2,
    "successful" : 1,
    "failed" : 0
  },
  "_seq_no" : 8,
  "_primary_term" : 1
}

Get (The [.] is included in the field name):

curl -XGET 'localhost:9200/test/test/1'
{ "_index":"test","_type":"test","_id":"1","_version":9,"found":true,"_source": {
"foo." : {
    "foo" : {
        "bar" : 123 
    }
} 
}

I was looking at the following GitHub / Elasticsearch Discuss Posts

  1. https://discuss.elastic.co/t/name-cannot-be-empty-string-error-if-field-name-starts-with/66808
  2. Allowing dots in field names #15951

Based on these, it seems like the second example should be throwing the same error as the first example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    :Search Foundations/MappingIndex mappings, including merging and defining field types>bugTeam:Search FoundationsMeta label for the Search Foundations team in Elasticsearchpriority:normalA label for assessing bug priority to be used by ES engineers

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions