Here is the version of elasticsearch2.4.4 that is downloaded
Elasticsearch-head-master
Https://github.com/mobz/elasticsearch-head
Modify a file
Double-click such as Bat
HTTP://192.168.2.104:9200/_PLUGIN/HEAD/,192.168.2.104 is the native IP that was just configured in the configuration file
You can also generate the win service directly
Maven adds the following jar package
<dependency>
<groupid>org.springframework.boot</groupid>
<artifactId> Spring-boot-starter-data-elasticsearch</artifactid>
<version>1.5.1.release</version>
</dependency>
Add a profile for ES
@Configuration @enableelasticsearchrepositories (basepackages = " Com.example.demo.dao ") public class Esconfig {@Value (" ${elasticsearch.host} ") Private String eshost; @Value ("${elasticsearch.port}") private int esport; @Value ("${elasticsearch.clustername}") Private String esclustername; @Bean Public Client Client () throws Exception {Settings essettings = Settings.settingsbuilder () . put ("Cluster.name", Esclustername). Build (); https://www.elastic.co/guide/en/elasticsearch/guide/current/_transport_client_versus_node_client.html return Transportclient.builder (). Settings (essettings). Build (). addtransportaddress (New Inetsockettransportaddress (Inetaddress.getbyname (eshost), esport)); } @Bean Public Elasticsearchoperations elasticsearchtemplate () throws Exception {return new Elasticsearchtem Plate (client ()); }
This must and ES configuration file inside is corresponding or will error, port number default is this.
Here is the index and type of the configuration
The following creates an interface extension es JPA, where basic additions and deletions are implemented
Public Interface extends Elasticsearchrepository<esproduct, string> { esproduct Save (esproduct esproduct); /* * * @author: wangchao * @date: 2017/9/22 * @methodName: Paging Data * @param Null * @return */ Page<EsProduct> findbylocationname (String LocationName, pageable pageable);}
The following is a simple query implemented by ID
@GetMapping ("/search") public responseentity<esproduct> Getsearch (@RequestParam ("id") String ID) { esproduct Esproduct=uzaiproductservice.findone (ID); return new Responseentity<esproduct> (Esproduct, Httpstatus.ok); }
The curd of ES is realized by this basic spring boot.
Elasticsearch application under the Spring Boot project