title: Consider defining a bean named 'elasticsearchTemplate' in your configuration
body: <p>I have just started springboot and tried to implement elastic search with spring-boot but I am getting this type of error while running spring-boot app</p>
  <blockquote>
  <p>Consider defining a bean named 'elasticsearchTemplate' in your configuration.</p>
  </blockquote>
  <h1>POM.XML</h1>
  <pre class="lang-xml prettyprint-override"><code>    &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
              &lt;artifactId&gt;jstl&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.tomcat.embed&lt;/groupId&gt;
              &lt;artifactId&gt;tomcat-embed-jasper&lt;/artifactId&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
             &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
             &lt;artifactId&gt;spring-boot-devtools&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.webjars&lt;/groupId&gt;
              &lt;artifactId&gt;bootstrap&lt;/artifactId&gt;
              &lt;version&gt;4.0.0&lt;/version&gt;
          &lt;/dependency&gt;
           &lt;dependency&gt;
              &lt;groupId&gt;org.elasticsearch.client&lt;/groupId&gt;
              &lt;artifactId&gt;transport&lt;/artifactId&gt;
              &lt;version&gt;5.6.10&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-data-elasticsearch&lt;/artifactId&gt;
          &lt;/dependency&gt;
          
          
      &lt;/dependencies&gt;
  </code></pre>
  <h1>Repository</h1>
  <pre><code>@Repository
  public interface StudentRepository extends ElasticsearchRepository&lt;Student, Integer&gt;{}
  </code></pre>
  <h1>Controller</h1>
  <pre><code>@RestController
  public class Controller {
      
      @Autowired
      StudentRepository studentRepo;
      
      @GetMapping(value=&quot;/student/all&quot;)
      List&lt;Student&gt; getAllStudent() {
          
          Iterator&lt;Student&gt; studentList = studentRepo.findAll().iterator();
          List&lt;Student&gt; students = new ArrayList&lt;&gt;();
          if(studentList.hasNext()) {
              students.add(studentList.next());
          }
          return students;
      }
      
      @PostMapping(value=&quot;/student/add&quot;)
      String addStudent(@RequestBody Student student) {
          
          studentRepo.save(student);
          return &quot;Record Added Successfully&quot;;
      } 
      
      @DeleteMapping(value=&quot;/student/delete/{id}&quot;)
      String deleteStudent(@PathVariable int id) {
          
          studentRepo.deleteById(id);
          return &quot;Record Deleted Successfully&quot;;
      }
      
      //@GetMapping(value=&quot;/student/findById/{id}&quot;)
      
  }
  </code></pre>
  <p>Can Anyone help me to resolve this error</p>
  <blockquote>
  <p>Consider defining a bean named 'elasticsearchTemplate' in your configuration.</p>
  </blockquote>