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 repeat type name in update mapping #4483

Closed
clintongormley opened this issue Dec 17, 2013 · 3 comments

Comments

Projects
None yet
3 participants
@clintongormley
Copy link
Member

commented Dec 17, 2013

Currently the update_mapping API requires the type name to be repeated in the body, eg:

POST /my_index/my_type/_mapping
{
    "my_type": {
        "properties": {...}
    }
}

This repetition is confusing and unnecessary. Instead should be OK to do:

 POST /my_index/my_type/_mapping
{
    "properties": {...}
}

Bonus points for making the change in a backwards compatible way :)

@kimchy

This comment has been minimized.

Copy link
Member

commented Jan 11, 2014

first, I don't fully agree with this issue, I don't think putting the type as top level is repetitive. It actually maps into what we are going to return in the get mapping API.

second, if we are going to do it, we have to make it backward compatible.

@dakrone

This comment has been minimized.

Copy link
Member

commented Jan 11, 2014

@kimchy this change is entirely backwards compatible. Either specifying the type (old method), or not specifying the type are supported.

See http://p.writequit.org/org/4483-dont-repeat-type.html for examples.

@dakrone

This comment has been minimized.

Copy link
Member

commented Jan 11, 2014

@kimchy I see your comment about the additional parameters at the top level, I'll make sure this is entirely backwards compatible with those settings, thanks for pointing those out!

dakrone added a commit to dakrone/elasticsearch that referenced this issue Jan 13, 2014

Make type wrapping optional for PUT Mapping API request
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 dakrone closed this in 2341825 Jan 13, 2014

brusic added a commit to brusic/elasticsearch that referenced this issue Jan 19, 2014

Make type wrapping optional for PUT Mapping API request
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

brwe added a commit to brwe/elasticsearch that referenced this issue May 8, 2014

Check if root mapping is actually valid
When a mapping is declared and the type is known from the uri
then the type can be skipped in the body (see elastic#4483). However,
there was no check if the given keys actually make a valid mapping.

closes elastic#5864

brwe added a commit to brwe/elasticsearch that referenced this issue May 10, 2014

Check if root mapping is actually valid
When a mapping is declared and the type is known from the uri
then the type can be skipped in the body (see elastic#4483). However,
there was no check if the given keys actually make a valid mapping.

closes elastic#5864

brwe added a commit that referenced this issue May 12, 2014

Check if root mapping is actually valid
When a mapping is declared and the type is known from the uri
then the type can be skipped in the body (see #4483). However,
there was no check if the given keys actually make a valid mapping.

closes #5864
closes #6093

brwe added a commit that referenced this issue May 12, 2014

Check if root mapping is actually valid
When a mapping is declared and the type is known from the uri
then the type can be skipped in the body (see #4483). However,
there was no check if the given keys actually make a valid mapping.

closes #5864
closes #6093
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.