# Elasticsearch-jdbc scientific notation issue

**URL:** <https://discuss.elastic.co/t/elasticsearch-jdbc-scientific-notation-issue/61388>\
**Category:** Elasticsearch\
**Created:** [September 23, 2016, 2:16pm UTC](https://discuss.elastic.co/t/elasticsearch-jdbc-scientific-notation-issue/61388 "2016-09-23T14:16:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mgvarley](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mgvarley/32/687_2.png) [@mgvarley](https://discuss.elastic.co/u/mgvarley)\
**Post date:** [September 23, 2016, 2:16pm UTC](https://discuss.elastic.co/t/elasticsearch-jdbc-scientific-notation-issue/61388/1 "2016-09-23T14:16:58Z")

</div>

Hi - I am using ES2.3.3 and the corresponding latest version of elasticsearch-jdbc. I am trying to import rows from a Postgres 9.5 DB where there are numbers stored as float8. Some of the numbers that are close to zero with several decimal places are stored coming across into Elasticsearch in scientific notation but with the decimal places truncated.

Example: 0.0000283 (2.83e-05) in Postgres is importing as 2.83 in Elasticsearch

As these values are being used for geographic coordinates the impact is significant and in some cases the locations are appearing in the wrong country. I have searched the forums and cannot find any known issue in the Postgres JDBC driver.

Any help on this would be much appreciated. Happy to submit a PR if you could point me in the direction of where to look?

---

<div class="post-metadata">

**Author:** ![mgvarley](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mgvarley/32/687_2.png) [@mgvarley](https://discuss.elastic.co/u/mgvarley)\
**Post date:** [September 24, 2016, 7:40am UTC](https://discuss.elastic.co/t/elasticsearch-jdbc-scientific-notation-issue/61388/2 "2016-09-24T07:40:49Z")

</div>

The solution I have come up with is to add explicit roundings in the query and a scale to the mapping however I still think the default behaviour of treating Postgres floats in scientific notation as numbers is dangerous. For other Postgres/PostGIS users I strongly recommend following the example below, ST\_X and ST\_Y functions return floats and without specifying the scale and rounding you leave it up to the driver to determine how to handle these.

The mapping I am using is as follows:

```auto
{
    "type": "jdbc",
    "jdbc": {
...
        "sql": "select round(ST_X(the_geom)::numeric,8) as \"location.lon\", round(ST_Y(the_geom)::numeric,8) as \"location.lat\" from my_table",
        "index": "my_index",
        "type": "my_type",
        "scale": 8
    }
}

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 10:17pm UTC](https://discuss.elastic.co/t/elasticsearch-jdbc-scientific-notation-issue/61388/3 "2017-07-05T22:17:32Z")

</div>


