title: Keeping elasticsearch and database in sync
body: <p>I am trying to figure out a way to keep my mysql db and elasticsearch db in sync. I have setup a jdbc river using the <a href="https://github.com/jprante/elasticsearch-river-jdbc">jprante / elasticsearch-river-jdbc</a> plugin for elasticsearch. When I execute the below request:</p>
  
  <pre><code>curl -XPUT 'localhost:9200/_river/my_jdbc_river/_meta' -d '{
  "type" : "jdbc",
  "jdbc" : {
      "driver" : "com.mysql.jdbc.Driver",
      "url" : "jdbc:mysql://localhost:3306/MY-DATABASE",
      "user" : "root",
      "password" : "password",
      "sql" : "select * from users",
      "poll" : "1m"
  },
  "index" : {
      "index" : "test_index",
      "type" : "user"
  }
  }'
  </code></pre>
  
  <p>the river starts indexing data, but for some records I get <code>org.elasticsearch.index.mapper.MapperParsingException</code>. Well there is discussion related to this issue <a href="https://github.com/elasticsearch/elasticsearch/issues/1331">here</a>, but I want to know a way to get around this issue. </p>
  
  <p>Is it possible to permanently fix this by creating an <a href="http://www.elasticsearch.org/guide/reference/mapping/">explicit mapping</a> for all 'fields' of the 'type' that I am trying to index or is there a better way to solve this issue?</p>
  
  <p>Another question that I have is, when the jdbc-river polls the database again, it seems to re-index the entire data-set(given in sql query) again into ES. I am not sure, but is this done because elasticsearch wants to add fresh data as well as update any changes in the existing data? Is it possible to index only the fresh data, if the table's data is static?</p>