Error in string field

Failed to parse [searchtext];
nested: MapperParsingException[failed to parse date field [], tried both date format [dateOptionalTime], and timestamp number];
nested: IllegalArgumentException[Invalid format: "".

I am getting the above error messsage while inserting docs with json data. The error field searchtext is of string datatype but it throwing exception as datetime.

i dont know what went wrong.. Advice to overcome this issue..

Its very urgent..

Thanks.

It looks like the field has been mapped as a date and you're trying to index a document where the field doesn't contain a date. If the field shouldn't be a date field you need to reindex. You should probably explicitly define the field as a string field to avoid having this happening again.

Thanks Magnusbaeck.

How to define that field as string field when i'm indexing docs using json data.

AFAIK you can't set the mapping of a field when you're indexing a document. Mappings are set either when you create the index (possibly implicitly via an index template) or with a put mapping API call (as long as the field whose mapping you're trying to define doesn't already exist).

Yeah, I understand.

Pls send any reference or example of how to create index with mapping using DSL.

Thanks.

Please see the Elasticsearch documentation and feel free to come back with any specific questions.

Ok. Thanks for your response.

I will refer document and get back you.

Thanks.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.