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

Fields defined in _source return other fields too #26292

Closed
aliostad opened this issue Aug 18, 2017 · 4 comments
Closed

Fields defined in _source return other fields too #26292

aliostad opened this issue Aug 18, 2017 · 4 comments

Comments

@aliostad
Copy link

Elasticsearch version: 5.1.2
Plugins installed: x-pack
JVM version: 1.8.0_111
OS version: Linux myvmname 3.16.0-43-generic #58~14.04.1-Ubuntu SMP Mon Jun 22 10:21:20 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Description of the problem including expected versus actual behavior:
If I define field foobar in the _source and my document has field foo, it will be returned. I find this happens if the content of the field is an array - but this is just an observation. Not sure how it could be related.

Steps to reproduce:

POST sisyphus/life
{
  "stone" : ["large"],
  "stoneWeight" : [500]
}

POST sisyphus/life
{
  "stone" : ["small"],
  "stoneWeight" : [200]
}

GET sisyphus/_search
{
  "_source": "stoneWeight", 
  "query": {
    "match_all": {}
  }
}

Returns stone as well as stoneWeight:

{
  "took": 4,
  "timed_out": false,
  "_shards": {
    "total": 5,
    "successful": 5,
    "failed": 0
  },
  "hits": {
    "total": 2,
    "max_score": 1,
    "hits": [
      {
        "_index": "sisyphus",
        "_type": "life",
        "_id": "AV32c1_JK9fID-KFUKqO",
        "_score": 1,
        "_source": {
          "stoneWeight": [
            500
          ],
          "stone": [
            "large"
          ]
        }
      },
      {
        "_index": "sisyphus",
        "_type": "life",
        "_id": "AV32c2hbK9fID-KFUKqP",
        "_score": 1,
        "_source": {
          "stoneWeight": [
            500
          ],
          "stone": [
            "large"
          ]
        }
      }
    ]
  }
}
@rjernst
Copy link
Member

rjernst commented Aug 18, 2017

I cannot reproduce this on master. Can you try on a more recent version of elasticsearch (say 5.5)?

@aliostad
Copy link
Author

I cannot reproduce on 5.4.

@jimczi
Copy link
Contributor

jimczi commented Aug 21, 2017

This is a duplicate of #22557 which was fixed by #22593 in es 5.2.1

@jimczi jimczi closed this as completed Aug 21, 2017
@aliostad
Copy link
Author

aliostad commented Aug 21, 2017

Thank you!
Appreciate quick turn-around.

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

3 participants