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
Closed

Don't repeat type name in update mapping #4483

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

Comments

@clintongormley
Copy link

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
Copy link
Member

kimchy 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
Copy link
Member

dakrone 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
Copy link
Member

dakrone 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
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
brusic pushed a commit to brusic/elasticsearch that referenced this issue Jan 19, 2014
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
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
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
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
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants