23

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

0

2 Answers 2

35

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Elastic 7.10 introduced new Fields feature. One can use this feature now to retrieve specific fields and the error in question should not occur.
5

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.