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

Mappings: Deprecate index_name and path #6677

Closed
jpountz opened this issue Jul 2, 2014 · 7 comments · Fixed by #9570
Closed

Mappings: Deprecate index_name and path #6677

jpountz opened this issue Jul 2, 2014 · 7 comments · Fixed by #9570
Assignees
Labels
>breaking :Search Foundations/Mapping Index mappings, including merging and defining field types Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch v2.0.0-beta1

Comments

@jpountz
Copy link
Contributor

jpountz commented Jul 2, 2014

Today we allow for custom index names. This adds ambiguity as fields might be referred to either according to their index name or their field name. What should happen when several fields have the same index name or if the index name of a field is the same as the full name of another field?

My understanding is that custom index_names are not useful anymore now that we have copy_to in order to index several logical fields into a single physical one, so I'd like to deprecate custom index_names so that the index name would always be the same as the full name.

Relates to #4081, #8870

@jpountz jpountz self-assigned this Jul 2, 2014
@clintongormley
Copy link
Contributor

++

@s1monw
Copy link
Contributor

s1monw commented Jul 2, 2014

huge +1 IMO we should start rejecting this setting on new created indices!

@dakrone
Copy link
Member

dakrone commented Jul 2, 2014

Yes! Deprecate in 1.3 and remove in master?

@s1monw
Copy link
Contributor

s1monw commented Jul 2, 2014

the removal is a problem IMO since this is a index level BWC issue :/

jpountz added a commit to jpountz/elasticsearch that referenced this issue Jul 28, 2014
@clintongormley clintongormley added v2.0.0-beta1 :Search Foundations/Mapping Index mappings, including merging and defining field types labels Nov 11, 2014
@clintongormley clintongormley changed the title Mappings: Deprecate custom index_names Mappings: Deprecate index_name and path Nov 27, 2014
@clintongormley
Copy link
Contributor

The index_name and path parameters are no longer needed now that we have copy_to. From 2.0, we should:

From 3.0:

  • remove index_name and path completely

@InfinitiesLoop
Copy link

For your consideration, please review this issue. Perhaps removing index_name will have a greater impact than intended.
#8980

@clintongormley
Copy link
Contributor

In 2.0, I think we can upgrade the mapping in a way that is not perfect, but will cover most use cases and help users to upgrade without reindexing.

index_name and path are used for two main purposes:

  • the old way to do copy_to
  • provide fieldname aliases, eg tag points to tags

We can't distinguish between these two use cases automatically, but we can handle the first use case gracefully, and the second use case is an easy change to make application side (ie just change all use of tags to tag in searches)

A mapping that looks like this (with path set to just_name):

{
  "mappings": {
    "test": {
      "properties": {
        "name": {
          "type": "object",
          "path": "just_name", 
          "properties": {
            "first": {
              "type": "string",
              "index_name": "fullname"
            },
            "last": {
              "type": "string",
              "index_name": "fullname"
            }
          }
        }
      }
    }
  }
}

could be rewritten to:

{
  "mappings": {
    "test": {
      "properties": {
        "fullname": {
          "type": "string"
        },
        "name": {
          "type": "object",
          "properties": {
            "first": {
              "index": "no",
              "copy_to": "fullname"
            },
            "last": {
              "index": "no",
              "copy_to": "fullname"
            }
          }
        }
      }
    }
  }
}

The mapping for the new fullname field can just be the same as the mapping of the first field which uses index_name (without the index_name) setting. The original field will not be indexed (or searchable).

In the case where path is set to full, the same rules apply, but the new field uses the full path name, ie this:

{
  "mappings": {
    "test": {
      "properties": {
        "name": {
          "type": "object",
          "path": "full", 
          "properties": {
            "first": {
              "type": "string",
              "index_name": "fullname"
            },
            "last": {
              "type": "string",
              "index_name": "fullname"
            }
          }
        }
      }
    }
  }
}

could be rewritten as:

{
  "mappings": {
    "test": {
      "properties": {
        "name": {
          "type": "object",
          "properties": {
            "first": {
              "index": "no",
              "copy_to": "name.fullname"
            },
            "last": {
              "index": "no",
              "copy_to": "name.fullname"
            },
            "fullname": {
              "type": "string"
            }
          }
        }
      }
    }
  }
}

@javanna javanna added the Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch label Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>breaking :Search Foundations/Mapping Index mappings, including merging and defining field types Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch v2.0.0-beta1
Projects
None yet
6 participants