Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 871
santosh kumar Avatar asked Feb 12 '19 09:02

santosh kumar


2 Answers

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.

like image 111
Val Avatar answered Sep 18 '22 11:09

Val


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

like image 33
robvankeilegom Avatar answered Sep 16 '22 11:09

robvankeilegom