Skip to content

InternalSearchHit.hasSource() returning incorrect value #21419

@puug

Description

@puug

Elasticsearch version: 5.0.0
Plugins installed: []
JVM version: 1.8
OS version: macOS 10.12.1

Description of the problem including expected versus actual behaviour:

InternalSearchHit.hasSource() seems to return incorrect values, and it's apparent why when you look at the source code:

    @Override
    public boolean hasSource() {
        return source == null;
    }

The SearchFieldsIT.testScriptDocAndFields() test also seems to be incorrect, expecting this wrong behaviour (since when specifying scripted fields, source is not returned unless explicitly requested) :

assertThat(response.getHits().getAt(0).hasSource(), equalTo(true));

Let me know if I've got this backwards, but I don't think so. At the very least if it's expected behaviour, the method name should change back to isSourceEmpty()

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions