Remove APIThe Delete API allows you to remove a typed JSON document from a specific index by ID. The following example:DeleteResponse response = client.prepareDelete("twitter", "tweet", "1") .execute() .actionGet();Manipulating threadsThe Get API allows to set the threading model the operation would be a performed when the actual execution of the API
, "found": true, "_source": {"title": "My First blog entry", "Text": "Just trying th Is out ... "," date ":" 2014/01/01 "}}For each situation found:[Email protected] ~]# Curl 192.168.100.10:9200/website/blog/1235?pretty{"_index": "website", "_type": "blog", "_id" : "1235", "found": false}_source is the content of the document. You can specify a value to return the field specified by the document[Email protected] ~]# curl-i-xget "192.168.100.10:9200/logstash-2016.05.12/syslog/avsliby3bzztddjuagzh
));
public static void Main (string[] args) {esapitest esapitest = new Esapitest ();
Esapitest.createindex ();
Esapitest.getindex (); }//CREATE INDEX + type + document public void CreateindeX () {//Generate index, use MAP to store map
Bulkprocessor set properties for a bulk request
Bulkprocessor bulkprocessor bulkprocessor = bulkprocessor.builder (client, new Bulkprocessor.listener () {@Overrid e public void Beforebulk (long arg0, bulkr
Elasticsearch Java API (ii): index create delete cluster managementElastic official website has the authoritative Java API English needs to be patient to see here to tidy up the basic operationCreate a MAVEN project to add dependencies First, customize a client to connect ES/*** Created by Forgeeks at 2017-03-22 18:27*/ Public classmyclient {PrivateSetting
();Transportclient client = new prebuilttransportclient (settings);Other transport client settings include:Client.transport.ignore_cluster_name: Set to True to ignore the checksum of the cluster name when the node is connectedClient.transport.ping_timeout: Set the wait time for a node to get response, default 5 SecondsClient.transport.nodes_sampler_interval: How long does it take to get/ping list of nodes and connect, default 5 secondsThree. View cluster information list client.connected
}/_mapping/{types}curl-xdelete Http://localhost:9200/{indices}/_alias/{names}curl-xdelete/HTTP Localhost:9200/{indices}/_warmer/{names}where {Indices},{type} and {name} can be any of the following:
_all , * or empty, these 3 values mean the same, representing all possible values
Wildcard characters, such as "test*"
Comma-delimited list, for example : index_1,test_*
The only exception is the delete command, which does not receive an empty value.If you want to delete anythin
First, the demandYou need to implement a field in the project to delete the document and delete a property of the specified field.Take document TEST/DOCUMENT/1 as an example:{ "_index":"Test", "_type":"Document", "_id":"1", "_score":1, "_source":{ "class":"Com.test.data", "ID":1, "Items":[{"class": "Com.test.data", "ID": 1 }], "lastupdated":"2016-07-22t11:26:56z", "ProcessInstance":{"class": "Com.test.data", "ID": 1 }, "Tians
To group queries by aggregation: SearchResponse response = Client.preparesearch (Index_douban). Settypes (Type_douban). Addaggregation (Aggregationbuilders.terms ("By_" +tag). Field (TAG). Size (1000)). Execute (). Actionget ();Terms Terms = Response.getaggregations (). Get ("By_" +tag);For (Bucket b:terms.getbuckets ()) {Sum sum = b.getaggregations (). Get ("sum");List.add (String) B.getkey ());System.out.println ("Filedname:" +b.getkey () + "Doccount:" +b.getdoccount ());}It is important to n
Count APIThe Count API allows developers to simply execute a query that returns the total number of documents that match the query criteria. It can be executed across multiple indexes and across multiple types.import static org.elasticsearch.index.query.xcontent.FilterBuilders.*;import static org.elasticsearch.index.query.xcontent.QueryBuilders.*;CountResponse response = client.prepareCount("test") .setQuery(termQuery("_type", "type1")) .execute() .ac
filterFilterBuilder filter = FilterBuilders.termFilter("colour", "pale");TermsFacetBuilder facet = FacetBuilders.termsFacet("f") .field("brand") .facetFilter(filter); // We apply it to the facetSearchResponse sr = node.client().prepareSearch() .setQuery(QueryBuilders.matchAllQuery()) .setFilter(filter) // We apply it to the query .addFacet(facet) .execute().actionGet();ScopeBy default, facets Act on the result set of the query. However, regardless of the query, you can use global parameters
View all Indexcurl http://localhost:9200/_cat/indices?v See all doc volumes Curl Http://localhost:9200/_cat/count?v View all node storage spaces Turntable Curl http://localhost:9200/_cat/allocation?v View all node file system Status Curl http://localhost:9200/_nodes/stats/ Fs?pretty View all node available disk sizes Curl Http://localhost:9200/_cat/nodes?h=h,diskavail Help=^.^=/_cat/allocation/_cat/shards/_cat/shards/{index}/_cat/master/_cat/nodes/_cat/indices/_cat/indices/{index} /_cat/segments
First, create an index/***** Setting Related Settings*/Static final Builder builder = Settings.builder (). Put ("Index.analysis.search_analyzer.default.type", "Ik_smart"). put ("Index.analysis.analyzer.default.type", "Ik_max_word"). Put ("Index.mapping.total_fields.limit", 30000);Client.admin (). Indices (). Preparecreate (IndexName). Setsettings (builder). get ();Second, delete the indexDeleteindexresponse response = Client.admin (). Indices (). Preparedelete (IndexName). Execute (). Actionget
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.