Reputation: 1
I just wrote a small Spring Boot application with ElasticSearch. Worked very well so far.
What's not working is the REST endpoint of ElasticSearch itself. I just want it be open to play a little bit with it. What's the trick here?
Update 5/26/2015:
Elasticsearch version is 1.3.2.
My main() class: Code works and no error message. But as I said, the REST API of ElasticSearch is not available. No open port listed at netstat:
import org.elasticsearch.client.Client;
import org.elasticsearch.node.NodeBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@Configuration
@EnableAutoConfiguration
@ComponentScan
public class SmartSearchRunner implements CommandLineRunner{
@Autowired
private AddressService addressService;
@Override
public void run(String... arg0) throws Exception {
System.out.println("Hello Spring Boot ElasticSearch!");
Address ingo = new Address();
ingo.setId("foo");
ingo.setName("ingo");
addressService.addAddress(ingo);
System.out.println(addressService.getByName("ingo"));
}
public static void main(String[] args) {
SpringApplication.run(SmartSearchRunner.class, args);
}
}
Upvotes: 0
Views: 1662
Reputation: 51
Put this in your Spring boot application properties:
spring.data.elasticsearch.properties.http.enabled=true
Upvotes: 5