Skip to content

Source filtering ("_source":false) don't work in collapse->inner_hits #23829

@Chakrygin

Description

@Chakrygin

Elasticsearch version: 5.3.0

Plugins installed: []

JVM version:
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)

OS version: Windows 10

Description of the problem including expected versus actual behavior:
Disabling "_source" retrieval (with setting it to false) don't work if used with collapse->inner_hits

Steps to reproduce:

  1. Test data:
POST http://localhost:9200/_bulk

{"index":{"_index":"test","_type":"test","_id":"1"}}
{"id":1,"group_id":4,"name":"one"}
{"index":{"_index":"test","_type":"test","_id":"2"}}
{"id":2,"group_id":4,"name":"two"}
{"index":{"_index":"test","_type":"test","_id":"3"}}
{"id":3,"group_id":4,"name":"three"}
  1. Test query:
POST http://localhost:9200/test/test/_search

{
	"query" : {
		"match_all" : { }
	},
	
	"_source" : false,
	
	"collapse" : {
		"field" : "group_id",
		"inner_hits" : {
			"name" : "some_name",
			"_source" : false
		}
	}
}

Describe the feature:

The response still contains "_source" elements:

{
  "took": 1,
  "timed_out": false,
  "_shards": {
    "total": 5,
    "successful": 5,
    "failed": 0
  },
  "hits": {
    "total": 3,
    "max_score": null,
    "hits": [
      {
        "_index": "test",
        "_type": "test",
        "_id": "2",
        "_score": 1,
        "fields": {
          "group_id": [
            4
          ]
        },
        "inner_hits": {
          "some_name": {
            "hits": {
              "total": 3,
              "max_score": 1,
              "hits": [
                {
                  "_index": "test",
                  "_type": "test",
                  "_id": "2",
                  "_score": 1,
                  "_source": {
                    "id": 2,
                    "group_id": 4,
                    "name": "two"
                  }
                },
                {
                  "_index": "test",
                  "_type": "test",
                  "_id": "1",
                  "_score": 1,
                  "_source": {
                    "id": 1,
                    "group_id": 4,
                    "name": "one"
                  }
                },
                {
                  "_index": "test",
                  "_type": "test",
                  "_id": "3",
                  "_score": 1,
                  "_source": {
                    "id": 3,
                    "group_id": 4,
                    "name": "three"
                  }
                }
              ]
            }
          }
        }
      }
    ]
  }
}

Metadata

Metadata

Assignees

Labels

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

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions