Distributed search ElasticSearch cluster creation and simple search instance applications

Source: Internet
Author: User

String clusterName = "elasticsearch_pudp"; = NodeBuilder. nodeBuilder (). clusterName (clusterName ). client (GetResponse response = node. client (). prepareGet ("datum", "datum", "" + 150 ObjectMapper mapper = Datum datum = mapper. convertValue (response. getSource (), Datum. system. out. println ("news title:" +

 

).node(); 

.

 InetSocketTransportAddress("192.168.0.149", 9300 InetSocketTransportAddress("192.168.0.162", 9300

Elasticsearch, elasticsearch \ config \ elasticsearch. yml file.

 auto-discovery. If you're running# multiple clusters on the same network, make sure you're using unique names.

 

String clusterName = "elasticsearch_pudongping" Settings settings = "cluster. name "TransportClient client = InetSocketTransportAddress (" 192.168.0.149 ", 9300 InetSocketTransportAddress (" 192.168.0.162 ", 9300 GetResponse response = client. prepareGet ("datum", "datum", "" + 130 = mapper. convertValue (response. getSource (), Datum. "Information title:" +

 

="client.transport.sniff", =  TransportClient(settings);

 

 

String clusterName = "elasticsearch_pudongping" Settings settings = "cluster. name ", clusterName ). put ("client. transport. sniff ", TransportClient client = client. addTransportAddress (InetSocketTransportAddress ("192.168.0.162", 9300 GetResponse response = client. prepareGet ("datum", "datum", "" + 130 ObjectMapper er ER = mapper. convertValue (response. getSource (), Datum. "Information No.:" + datum. getId () + "\ t news title:" + QueryBuilder query = QueryBuilders. multiMatchQuery ("enbip", "keyword" SearchResponse searchResponse = client. prepareSearch ("datum "). setTypes ("datum "). setQuery (query ). setFrom (3 ). setSize (5 List <Datum> lists = "Number of queried results:" + "info:" + dtm. getId () + "\ t news title:" + = mapper. convertValue (response. getSource (), Datum. list <Datum >=< Datum> datumList = ArrayList <Datum >== mapper. readValue (json, Datum.

 

51611171220 news title: Can I use eppup for a stroke?

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.