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

include_in_root with geo_shape is broken in 7 #70261

Closed
pmishev opened this issue Mar 10, 2021 · 6 comments
Closed

include_in_root with geo_shape is broken in 7 #70261

pmishev opened this issue Mar 10, 2021 · 6 comments
Labels
>bug :Search Foundations/Mapping Index mappings, including merging and defining field types Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch

Comments

@pmishev
Copy link

pmishev commented Mar 10, 2021

Elasticsearch version : 7.11.1

OS version: Ubuntu

Looks like include_in_root can no longer be used in conjunction with geo_shape fields, as removing any of those doesn't produce an error.

Reproducing the problem:

PUT ttt
{
  "mappings": {
    "properties": {
      "addresses": {
        "type": "nested",
        "include_in_root": true,
        "properties": {
          "name": {
            "type": "text"
          },
          "location": {
            "type": "geo_shape"
          }
        }
      }
    }
  }
}


PUT ttt/_doc/1
{
  "addresses": [
    {
      "name": "aaa",
      "location": {
        "type": "point",
        "coordinates": [
          150.121212,
          -30.121212
        ]
      }
    },
    {
      "name": "bbb",
      "location": {
        "type": "point",
        "coordinates": [
          150.121212,
          -30.121212
        ]
      }
    }
  ]
}

Results in:

{
  "error" : {
    "root_cause" : [
      {
        "type" : "illegal_argument_exception",
        "reason" : "DocValuesField \"addresses.location\" appears more than once in this document (only one value is allowed per field)"
      }
    ],
    "type" : "illegal_argument_exception",
    "reason" : "DocValuesField \"addresses.location\" appears more than once in this document (only one value is allowed per field)"
  },
  "status" : 400
}

The equivalent for ES 6.8, which works as expected with no errors:

PUT ttt
{
  "mappings": {
    "_doc": {
      "properties": {
        "addresses": {
          "type": "nested",
          "include_in_root": true,
          "properties": {
            "name": {
              "type": "text"
            },
            "location": {
              "type": "geo_shape"
            }
          }
        }
      }
    }
  }
}


PUT ttt/_doc/1
{
  "addresses": [
    {
      "name": "aaa",
      "location": {
        "type": "point",
        "coordinates": [
          150.121212,
          -30.121212
        ]
      }
    },
    {
      "name": "bbb",
      "location": {
        "type": "point",
        "coordinates": [
          150.121212,
          -30.121212
        ]
      }
    }
  ]
}
@pmishev pmishev added >bug needs:triage Requires assignment of a team area label labels Mar 10, 2021
@pmishev pmishev changed the title include_in_root is broken in 7 include_in_root is broken in 7 Mar 10, 2021
@pmishev pmishev changed the title include_in_root is broken in 7 include_in_root with geo_shape is broken in 7 Mar 11, 2021
@pmishev
Copy link
Author

pmishev commented Mar 11, 2021

I believe I have further narrowed down the issue to the new way geo_shapes are indexed (https://www.elastic.co/guide/en/elasticsearch/reference/current/breaking-changes-7.0.html#changed-default-geo-shape-index-strategy).
When I specify the tree option to a deprecated type, the error is no longer seen:

          "location": {
            "type": "geo_shape",
            "tree": "geohash"
          },

@dnhatn dnhatn added :Analytics/Geo Indexing, search aggregations of geo points and shapes and removed >bug needs:triage Requires assignment of a team area label labels Mar 15, 2021
@elasticmachine elasticmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Mar 15, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-analytics-geo (Team:Analytics)

@iverase
Copy link
Contributor

iverase commented Mar 16, 2021

The issue is that in the new way geo_shapes are indexed, doc values are generated by default and in the combination above, they are included twice on the root document which leads to the error you are seeing. This is indeed a bug, one way to avoid it, is to explicitly disable doc values:

PUT ttt
{
  "mappings": {
    "properties": {
      "addresses": {
        "type": "nested",
        "include_in_root": true,
        "properties": {
          "name": {
            "type": "text"
          },
          "location": {
            "type": "geo_shape",
            "doc_values" : false
          }
        }
      }
    }
  }
}

@jimczi jimczi added the :Search Foundations/Mapping Index mappings, including merging and defining field types label Mar 17, 2021
@iverase iverase added :Search/Search Search-related issues that do not fall into other categories :Search Foundations/Mapping Index mappings, including merging and defining field types and removed :Search Foundations/Mapping Index mappings, including merging and defining field types :Search/Search Search-related issues that do not fall into other categories labels Mar 17, 2021
@elasticmachine elasticmachine added the Team:Search Meta label for search team label Mar 17, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search (Team:Search)

@jimczi jimczi removed the :Search Foundations/Mapping Index mappings, including merging and defining field types label Oct 28, 2021
@elasticmachine elasticmachine removed the Team:Search Meta label for search team label Oct 28, 2021
@wchaparro
Copy link
Member

@javanna we think this is a mapping problem. Could you take a look pls?

@wchaparro wchaparro added the Team:Search Meta label for search team label Mar 22, 2022
@javanna javanna added :Search Foundations/Mapping Index mappings, including merging and defining field types >bug and removed :Analytics/Geo Indexing, search aggregations of geo points and shapes Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) labels Mar 28, 2022
@javanna
Copy link
Member

javanna commented Jun 13, 2024

Closing as a duplicate of #89164 . The problem still reproduces in more recent versions.

@javanna javanna closed this as not planned Won't fix, can't repro, duplicate, stale Jun 13, 2024
@javanna javanna added Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch and removed Team:Search Meta label for search team labels Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Search Foundations/Mapping Index mappings, including merging and defining field types Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch
Projects
None yet
Development

No branches or pull requests

7 participants