1

I am developing a command which reads the file and stores data in mongoDB database. For search instance I'm using elastic search. I have used exercise/elastica-bundle for that.

When I create mapping for index, I'm getting error for "dob" field.

    MapperParsingException[failed to parse [dob]]; 
    nested: MapperParsingException[failed to parse date field [], tried both date
    format [dateOptionalTime], and timestamp number with locale [null]]; nested:
    IllegalArgumentException[Invalid format: ""];

This is my mapping in config.yml file:

    person:
        mappings:
            name:  { index: not_analyzed }
            title: { index: not_analyzed }
            dob:   { index: not_analyzed }
            position:         { index: not_analyzed }
            address:         { index: not_analyzed }
            postCode:         { index: not_analyzed }
            country:          { index: not_analyzed }
            otherInformation: { index: not_analyzed }
        persistence:
            driver: mongodb
            model: MDM\MainBundle\Document\Person
            provider: ~
            listener: ~
            finder: ~

If I provide,

    dob: { type: date, format: "yyyy-mm-dd",  index: not_analyzed }

It gives me error,

    [Symfony\Component\Config\Definition\Exception\InvalidConfigurationException]                     
    Unrecognized options "format" under "foq_elastica.indexes.storage.types.list.mappings.dob"

EDIT: I have not found any solution yet, But for now I did this

    dob: { type: string, index: not_analyzed }

and now I can make entry in my elastic index.

1 Answer 1

0

There are several "default" date format in elasticSearch. You should check if you find corresponding patern fitting your needs. In case you do not, you can also do custom format date.

Then your format would probably be the basic_date and the format as following :

dob: { type: date, format: "yyyyMMdd",  index: not_analyzed }
3
  • format is not my problem, Problem is it gives me configuration exception when I try to provide "format". [Symfony\Component\Config\Definition\Exception\InvalidConfigurationException] Unrecognized options "format"... Mar 12, 2014 at 6:28
  • That is what i tried to say, your format is not recognize as a default format by elastic search.
    – user3279067
    Mar 12, 2014 at 7:38
  • I tried with your solution and several other formats, It always gives me the same error. Its not format issue, It is definitely configuration related issue. Mar 12, 2014 at 11:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.