title: Spring Data Elasticsearch - No converter found capable of converting from type [java.lang.Long] to type [java.time.Instant]
body: <p>When pulling a document from an elasticsearch (7.6.2) index with the use of <code>spring-data-elasticsearch</code> (4.0.0.RELEASE) I get:</p>
  <pre><code>No converter found capable of converting from type [java.lang.Long] to type [java.time.Instant]
  </code></pre>
  <p>I tried using ElasticsearchRepository:</p>
  <pre><code>Contact indexedContact = contactElasticRepository.findById(someId).orElse(null);
  </code></pre>
  <pre><code>package com.example.mail.elastic;
  
  import com.example.mail.model.Contact;
  import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
  
  public interface ContactElasticRepository extends ElasticsearchRepository&lt;Contact, String&gt; {
  
  }
  </code></pre>
  <p>Or issuing a query directly like this:</p>
  <pre><code>public Contact findById(String id) {
          Query searchQuery = new NativeSearchQueryBuilder()
              .withQuery(QueryBuilders.matchQuery(&quot;id&quot;, id)).build();
  
          SearchHits&lt;Contact&gt; contacts = elasticsearchTemplate.search(searchQuery, Contact.class, IndexCoordinates.of(&quot;mail&quot;));
          return contacts.getSearchHit(0).getContent();
  }
  </code></pre>
  <p>Both approaches have the same result with the problem above.</p>
  <p>My model is defined like this:</p>
  <pre><code>package com.example.mail.model;
  
  import java.util.Set;
  import java.util.HashSet;
  
  import javax.persistence.*;
  import javax.validation.constraints.NotNull;
  
  import org.hibernate.annotations.GenericGenerator;
  import org.springframework.data.elasticsearch.annotations.Document;
  
  @Entity
  @Table(name = &quot;contacts&quot;)
  @Document(indexName=&quot;mail&quot;, type=&quot;contact&quot;)
  public class Contact {   
      @Id 
      @GeneratedValue(generator=&quot;system-uuid&quot;)
      @GenericGenerator(name=&quot;system-uuid&quot;, strategy = &quot;uuid&quot;)
      private String id;
  
      @NotNull
      @Column(length = 255)
      private String firstName;
  
      @NotNull
      @Column(length = 255)
      private String lastName;
  
      @NotNull
      @Column(length = 255)
      private String displayName;
  
      @NotNull
      @Column(length = 255)
      private String email;
  
      @Lob
      private String note;
  
      @OneToMany(mappedBy=&quot;contact&quot;, fetch = FetchType.EAGER, cascade = CascadeType.REMOVE, orphanRemoval = true)
      private Set&lt;Photo&gt; photos =  new HashSet&lt;&gt;();
  
      @ManyToOne
      @JoinColumn(name=&quot;user_id&quot;, nullable=false)
      private User user;
  
     // ...getters and setters
  }
  </code></pre>
  <p>Note that the model uses @Entity and @Document at the same time.</p>
  <p>I cannot find any examples or documentation about additional mapping configuration or libraries needed.</p>