pythonelasticsearchpyes

MapperParsingException: No handler for type [date_hour_minute_second] declared on field


I am developing a driver with Python Pyes client for Elasticsearch. I need mapping indexes with a date column has format No "date_hour_minute_second" based on docs http://www.elasticsearch.org/guide/reference/mapping/date-format/ also I check pyes docs https://pyes.readthedocs.org/en/latest/guide/reference/mapping/date-format.html

When I use "date_hour_minute_second" format for my field I got the exception mentioned in title.

Here is my field definition:

      "date": {
           "boost": 1.0,
           "store": "yes",
           "type": "date_hour_minute_second_fraction",
           "term_vector": "with_positions_offsets"
       }

I could not figure it out why it throws an exception like that even docs say it is supported.


Solution

  • I think you have put the mapping in slightly wrong, the "date" you have is the field name, you also need "type": "date" Try this:

    "date": {
        "type": "date",
        "format": "date_hour_minute_second_fraction",
        "store": "yes"
    }
    

    "boost" is 1.0 by default, so not needed.

    Also I would question why you need "store": "yes", unless you have turned global storing off (it's on by default, and the whole document you sent to elasticsearch can be retrieved).

    Lastly, "term_vector": "with_positions_offsets" is not an applicable parameter for "date" types. Have a look at the elasticsearch docs on core types and scroll to the date section.

    Good luck!