Error in string field


(Madhan Kumar) #1

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.


(Magnus Bäck) #2

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.


(Madhan Kumar) #3

Thanks Magnusbaeck.

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


(Magnus Bäck) #4

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).


(Madhan Kumar) #5

Yeah, I understand.

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

Thanks.


(Magnus Bäck) #6

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


(Madhan Kumar) #7

Ok. Thanks for your response.

I will refer document and get back you.

Thanks.


(system) #8

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