# Problem with ElasticsearchRepository

**URL:** https://discuss.elastic.co/t/problem-with-elasticsearchrepository/149436
**Category:** Elasticsearch
**Created:** [September 21, 2018, 11:06am UTC](https://discuss.elastic.co/t/problem-with-elasticsearchrepository/149436 "2018-09-21T11:06:38Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![ritwik1994](https://avatars.discourse-cdn.com/v4/letter/r/e56c9b/32.png) [@ritwik1994](https://discuss.elastic.co/u/ritwik1994)
#### Post date: [September 21, 2018, 11:06am UTC](https://discuss.elastic.co/t/problem-with-elasticsearchrepository/149436/1 "2018-09-21T11:06:38Z")

</div>

I have made an entity in spring boot using @Document and @Entity annotation. Code goes like :-

// Code

```auto
@Entity
@Document(indexName = "content", type = "doc")
public class Content implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long contentId;
@Field(type = Date)
@Column(updatable=false, insertable=false)
private LocalDateTime dateAdded;
@Field(type = Date)
@Column(updatable=false, insertable=false)
private LocalDateTime dateModified;

...... With getter and setter basically. Normal POJO basically.
}

```

And i have made the repository using :-

//Code

```auto
@Repository
public interface ElasticSearch extends ElasticsearchRepository<Content, Long>{

@Query("{"bool": {"must": [{"match": {"authors.name": "?0"}}]}}")
Page findByAuthorsNameUsingCustomQuery(String name, Pageable pageable);

@Query("{"bool": {"must": {"match_all": {}}, "filter": {"term": {"tags": "?0" }}}}")
Page vf(String tag, Pageable pageable);

@Query("{"bool": {"must": {"match": {"authors.name": "?0"}}, "filter": {"term": {"tags": "?1" }}}}")
Page findByAuthorsNameAndFilteredTagQuery(String name, String tag, Pageable pageable);
}

```

But as soon as I am running my spring boot application my system is giving error like :-

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'contentController': Unsatisfied dependency expressed through field 'contentSearchService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'contentSearchImpl': Unsatisfied dependency expressed through field 'contentSearch'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contentSearch': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Failed to create query for method public abstract java.lang.Object org.springframework.data.elasticsearch.repository.ElasticsearchRepository.index(java.lang.Object)! No property index found for type Content! at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:586) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE] at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]

I have tried many things. Can someone please help with this.

---

<div class="post-metadata">

### Author: ![Kurzer\_Patrick](https://avatars.discourse-cdn.com/v4/letter/k/9de053/32.png) [@Kurzer\_Patrick](https://discuss.elastic.co/u/Kurzer_Patrick)
#### Post date: [September 25, 2018, 8:47am UTC](https://discuss.elastic.co/t/problem-with-elasticsearchrepository/149436/2 "2018-09-25T08:47:53Z")

</div>

Could you try to remove `@Repository` annotation and try again. I think JPA tries to scan this class and does not find `index` in your `Entity`.

Here is a stackoverflow answer which can also help: [no-property-index-found-for-type-user](https://stackoverflow.com/questions/36252099/no-property-index-found-for-type-user)

---

<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: [October 23, 2018, 8:47am UTC](https://discuss.elastic.co/t/problem-with-elasticsearchrepository/149436/3 "2018-10-23T08:47:53Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
