Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mapping of mysql:date/datetime/timestamp fields to es:date type #1

Closed
JensLohr opened this issue Jun 21, 2012 · 1 comment
Closed

Comments

@JensLohr
Copy link

Hi, congratulations for the jdbc-river!

I've tested a case with different date formats, here is the MySQL dump:

CREATE TABLE IF NOT EXISTS `date_test` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`field_int` int(10) NOT NULL,
`field_date` date NOT NULL,
`field_datetime` datetime NOT NULL,
`field_timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`field_datestring` char(10) COLLATE utf8_bin NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=3;

INSERT INTO `date_test` (`id`, `field_int`, `field_date`, `field_datetime`, `field_timestamp`, `field_datestring`) VALUES
(1, 1340223504, '2012-06-20', '2012-06-20 00:00:00', '2012-06-21 00:00:00', '2012-06-20'),
(2, 1123123123, '2012-06-16', '2012-06-20 22:54:11', '2012-06-21 00:02:31', '2012-06-16');

The resulting mapping in elasticsearch is:

mappings: {
jdbc: {
    properties: {
        id: {
            type: long
        }
        field_date: {
            type: long
        }
        field_timestamp: {
            type: long
        }
        field_datestring: {
            format: dateOptionalTime
            type: date
        }
        field_int: {
            type: long
        }
        field_datetime: {
            type: long
        }
    }
}
}

I did not expect that the field_datestring results in a date, but I guess this is being done by elasticsearch automatically.

Although field_int contains a timestamp, it is correct that it is being mapped to long.

For field_date, field_datetime, field_timestamp I would expect them to being mapped to a date/dateOptionalTime type.

Greetings from Munich,

Jens

@jprante
Copy link
Owner

jprante commented Jun 22, 2012

Thanks for your report! The issue should be fixed with 1.1.0.

@jprante jprante closed this as completed Jun 22, 2012
alexanderkjall pushed a commit to alexanderkjall/elasticsearch-river-jdbc that referenced this issue Dec 19, 2012
if you want to test the removal of the driver configuration option
pdegeus pushed a commit to pdegeus/elasticsearch-river-jdbc that referenced this issue Apr 19, 2013
@ghost ghost mentioned this issue Sep 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants