diff --git a/modules/library/src/main/scala/zio/elasticsearch/Document.scala b/modules/library/src/main/scala/zio/elasticsearch/Document.scala index 40d9fbcf4..af8ad4763 100644 --- a/modules/library/src/main/scala/zio/elasticsearch/Document.scala +++ b/modules/library/src/main/scala/zio/elasticsearch/Document.scala @@ -10,6 +10,6 @@ private[elasticsearch] final case class Document(json: String) { private[elasticsearch] object Document { def from[A](doc: A)(implicit schema: Schema[A]): Document = Document( - JsonCodec.jsonEncoder(schema).encodeJson(a = doc, indent = None).toString + JsonCodec.jsonEncoder(schema).encodeJson(doc, indent = None).toString ) } diff --git a/modules/library/src/main/scala/zio/elasticsearch/ElasticRequest.scala b/modules/library/src/main/scala/zio/elasticsearch/ElasticRequest.scala index 41fe68ae0..ea662630a 100644 --- a/modules/library/src/main/scala/zio/elasticsearch/ElasticRequest.scala +++ b/modules/library/src/main/scala/zio/elasticsearch/ElasticRequest.scala @@ -26,11 +26,18 @@ object ElasticRequest { def create[A: Schema]( index: IndexName, - id: Option[DocumentId], + id: DocumentId, doc: A, - routing: Option[Routing] = None + routing: Option[Routing] + ): ElasticRequest[Unit] = + Create(index, Some(id), Document.from(doc), routing) + + def create[A: Schema]( + index: IndexName, + doc: A, + routing: Option[Routing] ): ElasticRequest[Unit] = - Create(index, id, Document.from(doc), routing) + Create(index, None, Document.from(doc), routing) def upsert[A: Schema]( index: IndexName,