Skip to content

_source filtering input validation & behavior #19008

@n0othing

Description

@n0othing

_source filtering returns the full contents of the _source when supplied with a number (as opposed to a string). It would be better to return nothing and/or not be valid + throw an error.

Add a document:

PUT myindex/mytype/1
{
  "field1": "Hello World!"
}

Pass in a number:

GET myindex/_search
{
  "_source": 1
}

The result:

{
  "took": 1,
  "timed_out": false,
  "_shards": {
    "total": 1,
    "successful": 1,
    "failed": 0
  },
  "hits": {
    "total": 1,
    "max_score": 1,
    "hits": [
      {
        "_index": "myindex",
        "_type": "mytype",
        "_id": "1",
        "_score": 1,
        "_source": {
          "field1": "Hello World!"
        }
      }
    ]
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    :Search/SearchSearch-related issues that do not fall into other categories>bughelp wantedadoptme

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions