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

Don't require mapping if specified in the request #4671

Closed

Conversation

dakrone
Copy link
Member

@dakrone dakrone commented Jan 9, 2014

This fixes #4483 and is backwards-compatible with our current behavior.

@kimchy
Copy link
Member

kimchy commented Jan 11, 2014

the main problem here is that a top level mapping can have more than just properties as top level object. Also run tests where, for example, the mapping is:

{
   "_routing" : { .... },
   "properties" : { ...}
}

you will see that a few lines above, there is a check that checks for a single top level object, and fails with an exception that says it must be a type. if this change is in, this needs to be fixed as well.

I commented on this issue, but we have to make this change backward comp. to support older indices.

@dakrone
Copy link
Member Author

dakrone commented Jan 13, 2014

@kimchy I've updated this PR so that it supports multiple top-level objects and is entirely backwards-compatible.

@s1monw
Copy link
Contributor

s1monw commented Jan 13, 2014

I think this patch looks good. The only thing that I think we should improve is the nameing of the commit, I had to go to the issues to figure out what this is about :)

Put mapping now supports either of these formats:

POST foo/doc/_mapping
{
  "doc": {
    "_routing": {"required": true},
    "properties": {
      "body": {"type": "string"}
    }
  }
}

or

POST foo/doc/_mapping
{
  "_routing": {"required": true},
  "properties": {
    "body": {"type": "string"}
  }
}

Closes elastic#4483
@dakrone
Copy link
Member Author

dakrone commented Jan 13, 2014

Merged in 2341825

@dakrone dakrone closed this Jan 13, 2014
@dakrone dakrone deleted the 4483-dont-require-type-if-unneeded branch April 21, 2014 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Don't repeat type name in update mapping
3 participants