title: Domain Class Field Type not Getting Mapped to Spring Data ElasticSearch
body: <p>I have a Domain Class of Books
  I use this for hibernate and elasticsearch both.</p>
  
  <pre><code>import java.util.Date;
  import javax.persistence.Column;
  import javax.persistence.Entity;
  import javax.persistence.Id;
  import javax.persistence.Table;
  import org.springframework.data.elasticsearch.annotations.DateFormat;
  import org.springframework.data.elasticsearch.annotations.Document;
  import org.springframework.data.elasticsearch.annotations.Field;
  import org.springframework.data.elasticsearch.annotations.FieldType;
  import org.springframework.format.annotation.DateTimeFormat;
  import org.springframework.format.annotation.DateTimeFormat.ISO;
  import com.fasterxml.jackson.annotation.JsonIgnore;
  
  @Entity
  @Table(name="books")
  @Document(indexName="booksearchserver",type="book")
  
  public class Book {
  
  @org.springframework.data.annotation.Id
  @Id
  @Column(name="bookIsbn")
  @Field(type = FieldType.Integer, store = true)
  private long bookIsbn;
  
  @Column(name="bookTitle")
  @Field(type = FieldType.String, store = true)
  private String bookTitle;
  
  @Column(name="authorId")
  @Field(type = FieldType.Integer, store = true)
  private int bookAuthorId;
  
  @Column(name="bookLanguage")
  @Field(type = FieldType.String, store = true)
  private String bookLanguage;
  
  @Column(name="bookPublisherId")
  @Field(type = FieldType.Integer, store = true)
  private short bookPublisherId;
  
  @Column(name="bookReleaseDate")
  @DateTimeFormat(iso=ISO.DATE_TIME)
  @Field(type = FieldType.Date, store = true, format=DateFormat.date)
  private Date bookReleaseDate;
  
  @JsonIgnore
  @Column(name="bookNoOfChapters")
  private short bookNoOfChapters;
  
  @JsonIgnore
  @Column(name="bookNoOfPages")
  private short bookNoOfPages;
  
  @JsonIgnore
  @Column(name="bookNoOfWords")
  private int bookWordCount;
  
  @JsonIgnore
  @Column(name="bookPrecededByIsbn" )
  private long bookPrecededBy;
  
  @JsonIgnore
  @Column(name="bookFollowedByIsbn")
  private long bookFollowedBy;
  
  
  @Column(name="bookDescription")
  @Field(type = FieldType.String, store = true )
  private String bookDescription;
  
  @JsonIgnore
  @Column(name="bookCoverImage")
  private String bookCover;
  </code></pre>
  
  <p>I have a repository Class</p>
  
  <pre><code>package co.in.searchServer.repository;
  
  org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
  
  import co.in.searchServer.model.Book;
  
  public interface ESDao extends ElasticsearchRepository&lt;Book,Long&gt; {
  Iterable&lt;Book&gt; search(QueryBuilder arg0);
  Book findBybookIsbn(long isbn);
  &lt;S extends Book&gt; S index(S arg0);
  }
  </code></pre>
  
  <p>On doing a </p>
  
  <pre><code>    GET booksearchserver/book/_mapping
      {
         "booksearchserver": {
            "mappings": {
               "book": {
                  "properties": {
                     "bookAuthorId": {
                        "type": "integer",
                        "store": true
                     },
                     "bookDescription": {
                        "type": "string",
                        "store": true
                     },
                     "bookIsbn": {
                        "type": "string",
                        "index": "not_analyzed"
                     },
                     "bookLanguage": {
                        "type": "string",
                        "store": true
                     },
                     "bookPublisherId": {
                        "type": "integer",
                        "store": true
                     },
                     "bookReleaseDate": {
                        "type": "date",
                        "store": true,
                        "format": "date"
                     },
                     "bookTitle": {
                        "type": "string",
                        "store": true
                     }
                  }
               }
            }
         }
      }
  </code></pre>
  
  <p>I have the Following Problems:</p>
  
  <ol>
  <li>the <strong><em>"bookIsbn"</em></strong> Field does not have the long data type as specified in elasticsearch.</li>
  <li>I have to use the @JsonIgnore to completely stop the field from being stored    in elastic search.</li>
  </ol>
  
  <p>I Have tried putting mapping using the elasticsearchTemplate Class as well.</p>
  
  <p>I think the Field Annotations are not working.</p>
  
  <p>please provide some experiences and solutions</p>