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

defining custom _all field without disabling default one does not fail #11855

Closed
nharraud opened this issue Jun 24, 2015 · 1 comment
Closed

Comments

@nharraud
Copy link

After some mistake (#11851) I found that one can create a custom _all field without disabling the default one, and the default _all field is still used at search time.

Here is the scenario:

DELETE myindex

POST myindex
{
  "mappings": {
    "record": {
        "properties": {
          "_all": {
            "type": "string"
          }
        }
    }
  }
}

==> no error even though default _all field is still enabled. 

PUT myindex/record/1
{
  "title": "my big universe"
}

GET myindex/_search
{
  "query": {
    "match": {
      "_all": "Universe"
    }
  }
}

==> returns the document. Default _all field is still used.

DELETE myindex

POST myindex
{
  "mappings": {
    "record": {
      "_all": { "enabled": false },
        "properties": {
          "_all": {
            "type": "string"
          }
        }
    }
  }
}

PUT myindex/record/1
{
  "title": "my big universe"
}

GET myindex/_search
{
  "query": {
    "match": {
      "_all": "Universe"
    }
  }
}

==> no result. OK

But strangely the search does not work even when I write in the _all field.

PUT myindex/record/1
{
  "_all": "Universe"
}

GET myindex/_search
{
  "query": {
    "match": {
      "_all": "Universe"
    }
  }
}

==> no document even though the _all field has been disabled before. KO

I am using the elasticsearch 1.6 container from docker.io

This is a minor issue as most people won't name their custom fields _all. Throwing an error in the mean time could be useful for people misplacing _all in their mapping. Or maybe forbidding completely the definition of a field named _all.

@clintongormley
Copy link

Closing in favour of #10456

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

No branches or pull requests

2 participants