Skip to content

Improving documentation about es.read.fields.include, and fixing a related bug #1822

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

Merged
merged 1 commit into from
Dec 14, 2021

Conversation

masseyke
Copy link
Member

The documentation for es.read.fields.include left room for confusion. Also the bevaior was different between spark 1,
spark 2, and spark 3 -- setting "es.read.fields.include" to part of a hierarchy caused a NullPointerException in spark 1
and spark 2.
Closes #1784

@masseyke
Copy link
Member Author

This is confusing, and easiest for me to think about using concrete examples. I added them in the integration tests in this PR, but it's probably easier to see without code. Using the schema from #1784:
root

 |-- features: struct (nullable = true)
 |    |-- hashtags: array (nullable = true)
 |    |    |-- element: struct (containsNull = true)
 |    |    |    |-- count: long (nullable = true)
 |    |    |    |-- text: string (nullable = true)

Say I have this data in elasticsearch:

features:
    hashtags:
        [
            {"text": "foo"},
            {"count":"bar"}
        ] 

If I leave "es.read.fields.include" unset or if I set it to "features.hashtags.*" I get

features:
    hashtags:
        [
            {"text": "foo"},
            {"count":"bar"}
        ] 

If I set "es.read.fields.include" to "features.hashtags" I get

features:
    hashtags:
        [
            {},
            {}
        ] 

If I set "es.read.fields.include" to "features.hashtags.text" I get

features:
    hashtags:
        [
            {"text": "foo"},
            {}
        ] 

Copy link
Member

@jbaiera jbaiera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for clarifying these.

@masseyke masseyke merged commit 4a14860 into elastic:master Dec 14, 2021
@masseyke masseyke deleted the fix/read-fields-include branch December 14, 2021 23:09
masseyke added a commit to masseyke/elasticsearch-hadoop that referenced this pull request Dec 20, 2021
masseyke added a commit to masseyke/elasticsearch-hadoop that referenced this pull request Dec 20, 2021
masseyke added a commit that referenced this pull request Dec 20, 2021
…lated bug (#1822) (#1833)

The documentation for es.read.fields.include left room for confusion. Also the bevaior was different between spark 1,
spark 2, and spark 3 -- setting "es.read.fields.include" to part of a hierarchy caused a NullPointerException in spark 1
and spark 2.
Closes #1784
masseyke added a commit that referenced this pull request Dec 20, 2021
…lated bug (#1822) (#1834)

The documentation for es.read.fields.include left room for confusion. Also the bevaior was different between spark 1,
spark 2, and spark 3 -- setting "es.read.fields.include" to part of a hierarchy caused a NullPointerException in spark 1
and spark 2.
Closes #1784
@jrodewig jrodewig removed the >docs label Jan 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Elasticsearch return empty list of objects to spark
3 participants