无法将mysql时间戳映射到elasticsearch

I want to insert one of my mysql tables into elasticsearch for search purposes but I am having problem mapping a timestamp from mysql into ES.

In mysql my timestamp looks like "2015-01-01 15:30:34", I have tried mapping it as "timestamp" / "int" / "long" but nothing works. And looking at the ES docs it looks like ES expect a timestamp to look like "2015-01-01T15:30:34"

with a "T" in it.

Cant I map a normal mysql timestamp as "2015-01-01 15:30:34" into ES?

Second question: Since I only have one table in MySql that I want to be searched I only have that table in ES. And I am doing so by: Every time a new row gets inserted/updated/deleted in MySql that same row gets inserted/updated/deleted right after into ES. Is that the right way to do it? In order to keep the index updated live.

I am using the Laravel package: https://github.com/adamfairholm/Elasticquent

Since thats the easiest one I found for someone whos new at ES.

The timestamp containing the T is in ISO 8601 format. Since Laravel uses Carbon you can use it to convert the string to ISO 8601 like so:

$myDateTime->toIso8601String();

As for your second question, you're approach is good. By syncing your MySQL insert, update and delete actions with ES, you assure that the ES index is up to date in near real time.

If doing real time reindexing of the ES documents turns out to be bad for performance (usually if you have frequent inserts, updates and deletes), you can setup a cron to sync and reindex the ES documents at a given interval.