jillesvangurp / kt-search

Multi platform kotlin client for Elasticsearch & Opensearch with easily extendable Kotlin DSLs for queries, mappings, bulk, and more.
MIT License
95 stars 23 forks source link

[BUG] indexDocument version should be a Long #86

Closed frisi closed 8 months ago

frisi commented 8 months ago

The version param in SearchClient.indexDocument should be of type Long instead of Int to support all usecases (eg using millis-since-epoch as version)

see also Elasticsearch Docs on indexing:

The value provided must be a numeric, long value greater than or equal to 0, and less than around 9.2e+18.

As a workaround, one can use extraParameters

   val version = 1697624118596L
   client.indexDocument(
                indexName,
                doc
                id = id,
//                version = version.toInt(),
                versionType = VersionType.External,
                extraParameters = mapOf(
                    "version" to "$version"
                ),

Your context

Will you be able to help with a pull request?

no, sorry ;-)

jillesvangurp commented 8 months ago

Thanks for reporting this. You are right, this should be a Long.