Unknown key for a START_ARRAY in [fields]. in elasticsearch

14,874

Solution 1

You should be using stored_fields or _source instead of fields, i.e.

stored_fields: ['snippet.publishedAt']

or

_source: ['snippet.publishedAt']

UPDATE:

From 7.10 onwards, a new fields features is now available.

Solution 2

For ES7.3 (current version as writing) you can pass a _source field which can contain a comma separated list of fields.

_source: 'snippet.publishedAt'

You can read more about this here

Share:
14,874
santosh kumar
Author by

santosh kumar

Updated on July 02, 2022

Comments

  • santosh kumar
    santosh kumar almost 2 years

    I have been trying to get the specific fields data from the index that is been provided but getting the error "Unknown key for a START_ARRAY in [fields]".

    Unknown key for a START_ARRAY in [fields].

    fields: ['snippet.publishedAt']

    my expected output out is it should provide the fields array in the hits