javaApi连接elasticsearch时失败:IllegalStateException

java.lang.IllegalStateException: Unsupported transport.type [netty4]

at org.elasticsearch.common.network.NetworkModule.getTransportSupplier(NetworkModule.java:212)
at org.elasticsearch.client.transport.TransportClient.buildTemplate(TransportClient.java:179)
at org.elasticsearch.client.transport.TransportClient.<init>(TransportClient.java:273)
at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:128)
at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:114)
at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:104)
at com.dmsdbj.bebavior.service.impl.ElasticClientOrIndexImp.getClient(ElasticClientOrIndexImp.java:33)
at testTransDataToEs.addData(testTransDataToEs.java:29)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:69)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:48)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:292)
at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:237)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

1个回答

es服务器版本和java客户端中版本不一致:

ma15732625261
我喜欢好听的音乐爱笑的你 谢谢您 的回复,pom文件多写了一个es坐标
2 年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
java怎么连接elasticsearch单节点

java怎么连接elasticsearch单节点,网上全是连接集群的,单例和集群的连接方式一样吗?

Elasticsearch java Client 分页时连接关闭问题

最近在做一个es 深度钻取功能,对源数据查询es默认分页时10条,于是做了一个分页界面,Client 写成单例模式了,每次返回时关闭client.close() 就会出现bug: NodeAvailableException[None of the configured nodes are available: [{#transport#-1}{192.168.170.69}{192.168.170.69:9300}]] at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:290) at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:207) at org.elasticsearch.client.transport.support.TransportProxyClient.execute(TransportProxyClient.java:55) at org.elasticsearch.client.transport.TransportClient.doExecute(TransportClient.java:288) at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:359) at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:86) at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:56) ``` ``` 不关闭虽然用了同一个实例,避免了每次请求,新生成新的实例,但是考虑连接总要关闭的,不知道有没有好的解释和办法?

Elasticsearch \ RuntimeException:JSON编码失败:第33行文件/Elasticsearch/Serializers/SmartSerializer.php中的5

<div class="post-text" itemprop="text"> <p>I am trying to run a project that uses elasticsearch on my computer. But at the point that the API. Queries something from elasticsearch I get the following error and the query does not execute:</p> <pre><code>Elasticsearch\Common\Exceptions\RuntimeException: Failed to JSON encode: 5 in file /Users/sobhan.bagheri/projects/laravel/regionsdelen-api/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Serializers/SmartSerializer.php on line 33 </code></pre> <p>I am using: <code>laravel framework</code> with <code>valet</code> - <code>php7.1</code> - <code>elasticsearch 6.1.2</code> - and <code>elasticsearch/elasticsearch:v6.0.1</code> for the driver.</p> <p>I tried everything like changing elasticsearch to newer or older versions. Changing the way of the client connects to elasticsearch and also changed versions of the <code>elasticsearch/elasticsearch</code> driver but nothing seems to work.</p> <p>btw: those versions I mentioned are the exact ones running on another machine without this error.</p> <p>P.S: This error only occurres when I query a swedish character.</p> </div>

无法从另一个容器连接到ElasticSearch容器

<div class="post-text" itemprop="text"> <p>I'm trying to connect to an <code>ElasticSearch</code> container from a <code>Golang</code> container using the official <code>go-elasticsearch</code> api. However when I try and connect to the container I get this error:</p> <p><code>Error getting response: dial tcp 172.28.0.2:9200: connect: connection refused</code></p> <p>I think it's an issue in the container setup?</p> <h1>docker-compose.yaml</h1> <pre><code>version: "3" services: redis_server: image: "redis" ports: - "6379:6379" lambda_server: build: . ports: - "8080:50051" depends_on: - redis_server - elasticsearch elasticsearch: image: docker.elastic.co/elasticsearch/elasticsearch:7.3.1 ports: - "9200:9200" - "9300:9300" environment: - xpack.security.enabled=false - discovery.type=single-node - http.cors.enabled=true - http.cors.allow-origin=* </code></pre> <h1>go</h1> <pre class="lang-golang prettyprint-override"><code>tlsConf := &amp;http.Transport{ TLSClientConfig: &amp;tls.Config{ Renegotiation: tls.RenegotiateOnceAsClient, Certificates: []tls.Certificate{cer}, }, } cfg := elasticsearch.Config{ Addresses: []string{ "http://elasticsearch:9200", "http://elasticsearch:9300", }, Transport: tlsConf, } elasticClient, err = elasticsearch.NewClient(cfg) res, err := elasticClient.Info() if err != nil { log.Fatalf("Error getting response: %s", err) } </code></pre> </div>

es的DSL查询语句转换成Java语句

我想把下面的es查询语句,使用es的Java api实现,有人知道怎么写吗???? GET /weijian/news/_search { "aggs": { "unique_title": { "terms": { "field": "title", "order": [ { "aggPostTime": "desc" } ], "size": 10000 }, "aggs": { "aggPostTime": { "min": { "field": "post_time" } } } } }, "size": 0 }

WebSocket连接失败:连接建立错误:net :: ERR_CONNECTION_REFUSED

<div class="post-text" itemprop="text"> <p>我正在使用Ratchet创建一个聊天的网页接口,弹跳出错误提示:</p> <p><code>main.js</code>:2 WebSocket 连接 <code>ws://localhost:8080/</code></p> <p><code>failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED</code></p> <p>我得到错误的代码如下:</p> <pre><code>$(document).ready(function () { var conn = new WebSocket('ws://localhost:8080'); var chatForm = $(".chatForm"), messageInputField = chatForm.find("#message"), messagesList = $(".messages-list"), usernameForm = $(".username-setter"), usernameInput = usernameForm.find(".username-input"); </code></pre> <p>我也改变了IP地址 <code>/etc/host</code> 为 <code>0.0.0.0</code> 只是为了确认。 你有什么建议来改变和修正这个错误吗?</p> </div>

Logstash与tcp,错误:java.io.IOException:连接被对等方重置

<div class="post-text" itemprop="text"> <p>我想在我的GolangApp中使用logstash。</p> <p>/etc/logstash/conf.d/first-pipeline.conf </p> <pre><code>input { tcp { port =&gt; 5959 codec =&gt; json } } #filter {} output { elasticsearch { hosts =&gt; [ "localhost:9200" ] } } </code></pre> <p>和用于运行logstash的命令:</p> <p>/usr/share/logstash/bin/logstash -f /etc/logstash/conf.d/first-pipeline.conf --path.settings=/etc/logstash</p> <pre><code> Sending Logstash logs to /var/log/logstash which is now configured via log4j2.properties [2018-12-09T09:11:14,984][WARN ][logstash.config.source.multilocal] Ignoring the 'pipelines.yml' file because modules or command line options are specified [2018-12-09T09:11:14,995][INFO ][logstash.runner ] Starting Logstash {"logstash.version"=&gt;"6.5.1"} [2018-12-09T09:11:16,968][INFO ][logstash.pipeline ] Starting pipeline {:pipeline_id=&gt;"main", "pipeline.workers"=&gt;4, "pipeline.batch.size"=&gt;125, "pipeline.batch.delay"=&gt;50} [2018-12-09T09:11:17,347][INFO ][logstash.outputs.elasticsearch] Elasticsearch pool URLs updated {:changes=&gt;{:removed=&gt;[], :added=&gt;[http://localhost:9200/]}} [2018-12-09T09:11:17,356][INFO ][logstash.outputs.elasticsearch] Running health check to see if an Elasticsearch connection is working {:healthcheck_url=&gt;http://localhost:9200/, :path=&gt;"/"} [2018-12-09T09:11:17,589][WARN ][logstash.outputs.elasticsearch] Restored connection to ES instance {:url=&gt;"http://localhost:9200/"} [2018-12-09T09:11:17,655][INFO ][logstash.outputs.elasticsearch] ES Output version determined {:es_version=&gt;6} [2018-12-09T09:11:17,660][WARN ][logstash.outputs.elasticsearch] Detected a 6.x and above cluster: the `type` event field won't be used to determine the document _type {:es_version=&gt;6} [2018-12-09T09:11:17,692][INFO ][logstash.outputs.elasticsearch] New Elasticsearch output {:class=&gt;"LogStash::Outputs::ElasticSearch", :hosts=&gt;["//localhost:9200"]} [2018-12-09T09:11:17,730][INFO ][logstash.outputs.elasticsearch] Using mapping template from {:path=&gt;nil} [2018-12-09T09:11:17,786][INFO ][logstash.outputs.elasticsearch] Attempting to install template {:manage_template=&gt;{"template"=&gt;"logstash-*", "version"=&gt;60001, "settings"=&gt;{"index.refresh_interval"=&gt;"5s"}, "mappings"=&gt;{"_default_"=&gt;{"dynamic_templates"=&gt;[{"message_field"=&gt;{"path_match"=&gt;"message", "match_mapping_type"=&gt;"string", "mapping"=&gt;{"type"=&gt;"text", "norms"=&gt;false}}}, {"string_fields"=&gt;{"match"=&gt;"*", "match_mapping_type"=&gt;"string", "mapping"=&gt;{"type"=&gt;"text", "norms"=&gt;false, "fields"=&gt;{"keyword"=&gt;{"type"=&gt;"keyword", "ignore_above"=&gt;256}}}}}], "properties"=&gt;{"@timestamp"=&gt;{"type"=&gt;"date"}, "@version"=&gt;{"type"=&gt;"keyword"}, "geoip"=&gt;{"dynamic"=&gt;true, "properties"=&gt;{"ip"=&gt;{"type"=&gt;"ip"}, "location"=&gt;{"type"=&gt;"geo_point"}, "latitude"=&gt;{"type"=&gt;"half_float"}, "longitude"=&gt;{"type"=&gt;"half_float"}}}}}}}} [2018-12-09T09:11:17,809][INFO ][logstash.inputs.tcp ] Automatically switching from json to json_lines codec {:plugin=&gt;"tcp"} [2018-12-09T09:11:17,862][INFO ][logstash.inputs.tcp ] Starting tcp input listener {:address=&gt;"0.0.0.0:5959", :ssl_enable=&gt;"false"} [2018-12-09T09:11:18,097][INFO ][logstash.pipeline ] Pipeline started successfully {:pipeline_id=&gt;"main", :thread=&gt;"#&lt;Thread:0x42d68f8e run&gt;"} [2018-12-09T09:11:18,157][INFO ][logstash.agent ] Pipelines running {:count=&gt;1, :running_pipelines=&gt;[:main], :non_running_pipelines=&gt;[]} [2018-12-09T09:11:18,329][INFO ][logstash.agent ] Successfully started Logstash API endpoint {:port=&gt;9600} </code></pre> <p>Code in golang:</p> <pre><code>import ( "encoding/json" "fmt" "github.com/heatxsink/go-logstash" "time" ) func main() { l := logstash.New("0.0.0.0", 5959, 5) _, err := l.Connect() if err != nil { fmt.Println(err) } dataMap := map[string]int{"apple": 5, "lettuce": 7} jsonMap, _ := json.Marshal(dataMap) err = l.Writeln(string(jsonMap)) if err != nil { fmt.Println(err) } } </code></pre> <p>当我试图请求登录应用程序时,终端会显示这个错误:</p> <blockquote> <p>[2018-12-09T09:12:41,954][ERROR][logstash.inputs.tcp ] Error in Netty pipeline: java.io.IOException: Connection reset by peer</p> </blockquote> <p>所有的东西都在我的本地系统中。请帮帮我!</p> </div>

为什么 elasticsearch 获取节点信息失败?

在 spring boot 项目中即成集成 elasticsearch(dao层数据与es交互使用的的是 spring-data-elasticsearch)首先安装了服务器端的 es 服务,和 head 插件,es 服务启动正常,node-1 为默认主节点,my-cluster 为集群名,如图: ![图片说明](https://img-ask.csdn.net/upload/201605/24/1464076273_991814.png) 在程序中,使用嵌入式node启动节点正常,方式如下: ``` Node node = NodeBuilder.nodeBuilder().node(); node.start(); ``` 但是,如果使用 TransportClient 建立 es 的 Client,方式如下: ``` TransportClient client = new TransportClient(settings); client.addTransportAddress(new InetSocketTransportAddress("127.0.0.1", 9300)); ``` 这是 ES 2.3 官网上面提供的 TransportClient 方式:https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/transport-client.html 使用 TransportClient 方式,启动程序后,程序可以正常启动,但是控制台一直不停报错,貌似是在一直监测节点,而节点一直没有被发现,所以不停报错,错误信息如下,应用程序控制台错误信息: ``` 2016-05-23 19:40:15.823 INFO 27655 --- [ main] org.elasticsearch.client.transport : [Aliyah Bishop] failed to get node info for [#transport#-1][XXX-MBP.lan][inet[/127.0.0.1:9300]], disconnecting... org.elasticsearch.transport.RemoteTransportException: Failed to deserialize exception response from stream Caused by: org.elasticsearch.transport.TransportSerializationException: Failed to deserialize exception response from stream at org.elasticsearch.transport.netty.MessageChannelHandler.handlerResponseError(MessageChannelHandler.java:173) at org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:125) at org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70) at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564) at org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791) at org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:296) at org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:462) at org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:443) at org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:303) at org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70) at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564) at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559) at org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:268) at org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:255) at org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88) at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:108) at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:318) at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89) at org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178) at org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108) at org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Caused by: java.io.StreamCorruptedException: Unsupported version: 1 at org.elasticsearch.common.io.ThrowableObjectInputStream.readStreamHeader(ThrowableObjectInputStream.java:46) at java.io.ObjectInputStream.<init>(ObjectInputStream.java:299) at org.elasticsearch.common.io.ThrowableObjectInputStream.<init>(ThrowableObjectInputStream.java:38) at org.elasticsearch.transport.netty.MessageChannelHandler.handlerResponseError(MessageChannelHandler.java:170) ... 23 common frames omitted …………. failed to load elasticsearch nodes : org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: [] ``` es 控制台报错信息: ``` [2016-05-23 21:45:56,807][WARN ][transport.netty ] [node-1] exception caught on transport layer [[id: 0x8e4b89bc, /127.0.0.1:62566 => /127.0.0.1:9300]], closing connection java.lang.IllegalStateException: Message not fully read (request) for requestId [233], action [cluster/nodes/info], readerIndex [39] vs expected [57]; resetting at org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:121) at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70) at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564) at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791) at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:296) at org.jboss.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:462) at org.jboss.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:443) at org.jboss.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:303) at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70) at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564) at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791) at org.elasticsearch.common.netty.OpenChannelsHandler.handleUpstream(OpenChannelsHandler.java:75) at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564) at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559) at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:268) at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:255) at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88) at org.jboss.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:108) at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:337) at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89) at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178) at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108) at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) ``` 而且,当我使用嵌入式node启动节点后,系统会自动启动一个node节点,node.name 也是随机的,并且并没有将该节点加入启动的es集群中,我加入的索引和数据也不能出现在 my-cluster 集群中 所以有两个问题: 1、为什么我使用嵌入式node启动节点,启动后的节点不会加入到集群中? 2、使用 TransportClient 方式建立 Client,启动程序后,程序的控制台,和服务器端的es一直报错,获取节点信息失败,是什么原因?即上面的错误信息 下面是环境版本信息: 服务器端 es 版本:2.3.3 jdk 版本:1.7.0_79 spring-data-elasticsearch 版本:1.2.0.RELEASE(即:elasticsearch-1.4.4.jar) 服务器端 es 配置,elasticsearch.yml: cluster.name: my-cluster node.name: node-1 http 端口为:9200 节点间的通信端口为:9300 关于第二个问题尝试了很多解决方案,比如: 1、应用 和 es 的 jdk 环境版本不一致。已检查过一致 https://github.com/elastic/elasticsearch/issues/3835 2、es 多个节点之间的JDK版本不一致。我使用的只是单节点,并且都在我本地机器上 http://jontai.me/blog/2013/06/elasticsearch-remotetransportexception-failed-to-deserialize-exception-response-from-stream/ 3、idk 版本过低,建议1.7+。已是1.7+ 最后附上两种启动节点方式的完整代码 1、嵌入式 node 启动 ``` import org.elasticsearch.client.Client; import org.elasticsearch.node.Node; import org.elasticsearch.node.NodeBuilder; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; @Configuration @EnableElasticsearchRepositories(basePackages = "xx.xxx.domain.repository.elastic") public class ElasticsearchConfiguration { @Bean public Client client() { Node node = NodeBuilder.nodeBuilder().node(); node.start(); return node.client(); } } ``` 2、TransportClient 方式 ``` import org.elasticsearch.client.Client; import org.elasticsearch.client.transport.TransportClient; import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.InetSocketTransportAddress; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.elasticsearch.core.ElasticsearchOperations; import org.springframework.data.elasticsearch.core.ElasticsearchTemplate; import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; @Configuration @EnableElasticsearchRepositories(basePackages = "xx.xxx.domain.repository.elastic") public class ElasticsearchConfiguration { @Bean public Client client() { TransportClient client = new TransportClient(); client.addTransportAddress(new InetSocketTransportAddress("127.0.0.1", 9300)); return client; } @Bean public ElasticsearchOperations elasticsearchTemplate() { return new ElasticsearchTemplate(client()); } } ```

elasticsearch插入数据报错

之前用的elasticsearch是1.3.2版本的,装了ik插件,用起来很正常,后面elasticsearch换成2.0.0的了,还装了logstash2.0.0,kibana4.2.0, ik分词器是1.5.0的,用Java代码批量插入的时候就报错了,在elasticsearch的控制台手动插入是没问题的 [INFO][2016-11-16 18:22:34] org.elasticsearch.plugins.PluginsService.<init>(PluginsService.java:151) main [Agatha Harkness] loaded [analysis-jcseg], sites [] [INFO][2016-11-16 18:22:35] org.elasticsearch.client.transport.TransportClientNodesService$SniffNodesSampler$1$1.handleException(TransportClientNodesService.java:443) elasticsearch[Agatha Harkness][transport_client_worker][T#1]{New I/O worker #28} [Agatha Harkness] failed to get local cluster state for [#transport#-1][USER-20150529VW][inet[localhost/127.0.0.1:9300]], disconnecting... org.elasticsearch.transport.RemoteTransportException: Failed to deserialize exception response from stream Caused by: org.elasticsearch.transport.TransportSerializationException: Failed to deserialize exception response from stream at org.elasticsearch.transport.netty.MessageChannelHandler.handlerResponseError(MessageChannelHandler.java:173) at org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:125) at org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70) at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564) at org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791) at org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:296) at org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:462) at org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:443) at org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:303) at org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70) at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564) at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559) at org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:268) at org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:255) at org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88) at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:108) at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:318) at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89) at org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178) at org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108) at org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: java.io.StreamCorruptedException: Unsupported version: 1 at org.elasticsearch.common.io.ThrowableObjectInputStream.readStreamHeader(ThrowableObjectInputStream.java:46) at java.io.ObjectInputStream.<init>(ObjectInputStream.java:299) at org.elasticsearch.common.io.ThrowableObjectInputStream.<init>(ThrowableObjectInputStream.java:38) at org.elasticsearch.transport.netty.MessageChannelHandler.handlerResponseError(MessageChannelHandler.java:170) ... 23 more [WARN][2016-11-16 18:22:35] org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:135) elasticsearch[Agatha Harkness][transport_client_worker][T#1]{New I/O worker #28} [Agatha Harkness] Message not fully read (response) for [0] handler org.elasticsearch.client.transport.TransportClientNodesService$SniffNodesSampler$1$1@7e8c9412, error [true], resetting [INFO][2016-11-16 18:22:39] org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:862) Thread-1 Closing org.springframework.context.support.GenericApplicationContext@fbd1f6: startup date [Wed Nov 16 18:21:55 CST 2016]; root of context hierarchy [INFO][2016-11-16 18:22:39] org.elasticsearch.node.internal.InternalNode.stop(InternalNode.java:272) Thread-1 [Fer-de-Lance] stopping ... [INFO][2016-11-16 18:22:39] org.elasticsearch.node.internal.InternalNode.stop(InternalNode.java:310) Thread-1 [Fer-de-Lance] stopped

elasticsearch超时问题

elasticsearch scroll Java 中设置的超时时间是针对查询出来的结果数据,还是结果数据和scrollId超过时间都会失效

spark读取elasticSearch时EsHadoopNoNodesLeftException

RT 我本机是能ping通elasticSearch的9200端口的。 org.elasticsearch.hadoop.rest.EsHadoopNoNodesLeftException: Connection error (check network and/or proxy settings)- all nodes faile]] at org.elasticsearch.hadoop.rest.NetworkClient.execute(NetworkClient.java:123) at org.elasticsearch.hadoop.rest.RestClient.execute(RestClient.java:303) at org.elasticsearch.hadoop.rest.RestClient.execute(RestClient.java:287) at org.elasticsearch.hadoop.rest.RestClient.execute(RestClient.java:291) at org.elasticsearch.hadoop.rest.RestClient.get(RestClient.java:118) at org.elasticsearch.hadoop.rest.RestClient.discoverNodes(RestClient.java:100) at org.elasticsearch.hadoop.rest.InitializationUtils.discoverNodesIfNeeded(InitializationUtils.java:57) at org.elasticsearch.hadoop.rest.RestService.createWriter(RestService.java:346) at org.elasticsearch.spark.rdd.EsRDDWriter.write(EsRDDWriter.scala:31) at org.elasticsearch.spark.rdd.EsSpark$$anonfun$saveToEs$1.apply(EsSpark.scala:34) at org.elasticsearch.spark.rdd.EsSpark$$anonfun$saveToEs$1.apply(EsSpark.scala:34) at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:87) at org.apache.spark.scheduler.Task.run(Task.scala:99) at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:282) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)

从golang主机应用程序连接到Docker中运行的Elasticsearch 6.4

<div class="post-text" itemprop="text"> <p>Go ES client <a href="https://godoc.org/gopkg.in/olivere/elastic.v6" rel="nofollow noreferrer">https://godoc.org/gopkg.in/olivere/elastic.v6</a> throws the "no active connection found: no Elasticsearch node available" error when attempting to connect from OS X host to ES running in docker container. There's many discussions on how to solve it in v5.*, however, I couldn't find anything for v6.4.</p> <p>Docker-compose part:</p> <pre><code>elasticsearch: image: elasticsearch:6.4.2 network_mode: "bridge" expose: - "9200" - "9300" volumes: - ./es-data:/usr/share/elasticsearch/data ports: - "9200:9200" - "9300:9300" </code></pre> <p>Go client call:</p> <pre><code>esClient, esClientErr := elastic.NewClient(elastic.SetURL("http://127.0.0.1:9200")) if esClientErr != nil { return nil, fmt.Errorf("Failed to connect to ES: %v", esClientErr) } </code></pre> <p>Output:</p> <pre><code>2018/11/09 15:57:54 Failed to connect to ES: no active connection found: no Elasticsearch node available exit status 1 </code></pre> <p><strong>UPDATE</strong></p> <p>Setting <code>network.publish_host: "_local_"</code> solved the problem. The <code>publish_address</code> is set to <code>127.0.0.1:9300</code> now.</p> </div>

springboot整合elasticsearch提示org.elasticsearch.transport.NodeDisconnectedException

<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-elasticsearch</artifactId> <version>2.1.4.RELEASE</version> </dependency> <dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-elasticsearch</artifactId> <version>2.1.4.RELEASE</version> </dependency> <dependency> <groupId>org.elasticsearch</groupId> <artifactId>elasticsearch</artifactId> <version>2.4.0</version> </dependency> <dependency> <groupId>org.elasticsearch.plugin</groupId> <artifactId>transport-netty4-client</artifactId> <version>6.4.0</version> </dependency> <dependency> <groupId>org.elasticsearch.client</groupId> <artifactId>transport</artifactId> <version>6.4.0</version> </dependency> application.yml 配置如下: spring: data: elasticsearch: cluster-nodes: 192.168.100.21:9300,192.168.100.22:9300,192.168.100.23:9300 cluster-name: wt repositories: enabled: true springboot版本1.5.8,linux安装ES版本是6.4.0,上面是工程里引入的jar,ES在浏览器能访问,且有数据,但是项目启动就连接不上 NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{192.168.100.21}{192.168.100.21:9300}, {#transport#-2}{192.168.100.22}{192.168.100.22:9300}, {#transport#-3}{192.168.100.23}{192.168.100.23:9300}] ] at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:290) at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:207) at org.elasticsearch.client.transport.support.TransportProxyClient.execute(TransportProxyClient.java:55) at org.elasticsearch.client.transport.TransportClient.doExecute(TransportClient.java:288)

根据sql,es的查询条件,怎么用java es api写出来。

Sql: ```sql select hour,count(*),avg(billDuration) from tab where customerNumber ='13201646126' group by hour ``` es: ```json GET cdr_20200110/_search { "size": 3, "query": { "term": { "customerNumber": "13201646126" } }, "aggs": { "hour_sum": { "terms":{ "field": "hour" }, "aggs": { "avg_bill": { "avg": { "field": "billDuration" } } } } } } ``` 自己写了个不知道对不对 ```java TermQueryBuilder termQueryBuilder = QueryBuilders.termQuery("customerNumber","13201646126"); AggregationBuilder aggsBuilder = AggregationBuilders.filter("hour_sum",termQueryBuilder); TermsAggregationBuilder terms = AggregationBuilders.terms("hour"); AvgAggregationBuilder avgs =AggregationBuilders.avg("avg_bill").field("billDuration"); terms.subAggregation(avgs); terms.subAggregation(aggsBuilder); ```

相对于java通过Elastic提供clientapi调用elasticsearch的查询,比直接拼接下面这种查询语句,通过httpclient发送查询的优势在哪里?

![图片说明](https://img-ask.csdn.net/upload/202005/21/1590069515_476570.png) 因为我这边的业务需要动态组合查询语句,感觉相对于es提供的api,这样自行拼接查询条件更方便点,而且后期也更容易纠错

java连接elasticsearch抛异常None of the configured nodes are available

阿里云上docker方式部署了单节点的6.5.3版本的es,elasticsearch.yml配置如下: ``` cluster.name: "docker-cluster" node.name: node-test network.bind_host: 0.0.0.0 network.publish_host: 58.87.73.232 discovery.zen.ping.unicast.hosts: ["58.87.73.232:9300"] discovery.zen.minimum_master_nodes: 1 http.cors.enabled: true http.cors.allow-origin: "*" ``` 通过springboot2.1.1项目集成spring-boot-starter-data-elasticsearch application.properties配置如下: ``` spring.data.elasticsearch.cluster-name=docker-cluster spring.data.elasticsearch.cluster-nodes=58.87.73.232:9300 ``` 启动项目的测试用例抛异常**NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{rLnGNbz3QFaEToPtiuFTgQ}{58.87.73.232}{58.87.73.232:9300}]] ** 请问什么原因? 附节点状态截图: ![图片说明](https://img-ask.csdn.net/upload/201909/10/1568100643_439007.png)

elasticsearch java多条件查询

同时满足多个条件,其中有一个字段EQUAL一个值, 一个字段和字符串数组进行比对EQUAL其中一个值, 有一个字段LIKE一个值,有两个字段其中一个字段要满足条件值 应该怎么做

在windows上安装elasticsearch

<div class="post-text" itemprop="text"> <p>This might be duplicate of lot of questions...</p> <p>I am trying to install elasticsearch on windows with php. I followed below steps to install</p> <ol> <li>Download zip and extract to c:\elasticsearch-6.3.2</li> <li>Run .\bin\elasticsearch.bat through command line</li> <li>Run .\bin\elasticsearch.bat -Ecluster.name=my_cluster -Enode.name=node_1 through command line</li> </ol> <p>But when I try to access this url <a href="http://127.0.0.1:9200" rel="nofollow noreferrer">http://127.0.0.1:9200</a> or <a href="http://localhost:9200" rel="nofollow noreferrer">http://localhost:9200</a> through browser its showing </p> <blockquote> <p>"This site can’t be reached"</p> </blockquote> <p>I tried to run through command line also like</p> <pre><code>curl -XGET localhost:9200 </code></pre> <p>I am getting response as </p> <blockquote> <p>curl: (7) Failed to connect to localhost port 9200: Connection refused</p> </blockquote> <p>I google for above error but getting answers for centos or ubuntu and not for windows. Can anyone help, I am new to elasticsearch.</p> <p>Below is log generated as elasticsearch.log</p> <blockquote> <p>[2018-07-31T12:34:04,301][INFO ][o.e.n.Node ] [] initializing ... [2018-07-31T12:34:04,481][INFO ][o.e.e.NodeEnvironment ] [G_YkjaN] using [1] data paths, mounts [[Windows (C:)]], net usable_space [500.6mb], net total_space [100gb], types [NTFS] [2018-07-31T12:34:04,481][INFO ][o.e.e.NodeEnvironment<br> ] [G_YkjaN] heap size [998.4mb], compressed ordinary object pointers [unknown] [2018-07-31T12:34:04,484][INFO ][o.e.n.Node ] [G_YkjaN] node name derived from node ID [G_YkjaN2T66OvWgjV9A6uQ]; set [node.name] to override [2018-07-31T12:34:04,484][INFO ][o.e.n.Node<br> ] [G_YkjaN] version[6.3.2], pid[3576], build[default/zip/053779d/2018-07-20T05:20:23.451332Z], OS[Windows 8.1/6.3/x86], JVM[Oracle Corporation/Java HotSpot(TM) Client VM/1.8.0_25/25.25-b02] [2018-07-31T12:34:04,485][INFO ][o.e.n.Node<br> ] [G_YkjaN] JVM arguments [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.io.tmpdir=C:\Users agkatke\AppData\Local\Temp\elasticsearch, -XX:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -XX:+PrintGCDetails, -XX:+PrintGCDateStamps, -XX:+PrintTenuringDistribution, -XX:+PrintGCApplicationStoppedTime, -Xloggc:logs/gc.log, -XX:+UseGCLogFileRotation, -XX:NumberOfGCLogFiles=32, -XX:GCLogFileSize=64m, -Delasticsearch, -Des.path.home=C:\elasticsearch-6.3.2, -Des.path.conf=C:\elasticsearch-6.3.2\config, -Des.distribution.flavor=default, -Des.distribution.type=zip] [2018-07-31T12:34:07,069][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [aggs-matrix-stats] [2018-07-31T12:34:07,070][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [analysis-common] [2018-07-31T12:34:07,070][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [ingest-common] [2018-07-31T12:34:07,070][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [lang-expression] [2018-07-31T12:34:07,071][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [lang-mustache] [2018-07-31T12:34:07,071][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [lang-painless] [2018-07-31T12:34:07,071][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [mapper-extras] [2018-07-31T12:34:07,073][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [parent-join] [2018-07-31T12:34:07,073][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [percolator] [2018-07-31T12:34:07,073][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [rank-eval] [2018-07-31T12:34:07,073][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [reindex] [2018-07-31T12:34:07,074][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [repository-url] [2018-07-31T12:34:07,074][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [transport-netty4] [2018-07-31T12:34:07,074][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [tribe] [2018-07-31T12:34:07,075][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [x-pack-core] [2018-07-31T12:34:07,075][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [x-pack-deprecation] [2018-07-31T12:34:07,075][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [x-pack-graph] [2018-07-31T12:34:07,076][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [x-pack-logstash] [2018-07-31T12:34:07,076][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [x-pack-ml] [2018-07-31T12:34:07,076][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [x-pack-monitoring] [2018-07-31T12:34:07,077][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [x-pack-rollup] [2018-07-31T12:34:07,078][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [x-pack-security] [2018-07-31T12:34:07,078][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [x-pack-sql] [2018-07-31T12:34:07,078][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [x-pack-upgrade] [2018-07-31T12:34:07,079][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [x-pack-watcher] [2018-07-31T12:34:07,080][INFO ][o.e.p.PluginsService ] [G_YkjaN] no plugins loaded [2018-07-31T12:34:11,043][INFO ][o.e.x.s.a.s.FileRolesStore] [G_YkjaN] parsed [0] roles from file [C:\elasticsearch-6.3.2\config oles.yml] [2018-07-31T12:34:11,361][ERROR][o.e.b.Bootstrap ] Exception org.elasticsearch.ElasticsearchException: X-Pack is not supported and Machine Learning is not available for [windows-x86]; you can use the other X-Pack features (unsupported) by setting xpack.ml.enabled: false in elasticsearch.yml at org.elasticsearch.xpack.ml.MachineLearningFeatureSet.isRunningOnMlPlatform(MachineLearningFeatureSet.java:102) ~[?:?] at org.elasticsearch.xpack.ml.MachineLearningFeatureSet.isRunningOnMlPlatform(MachineLearningFeatureSet.java:93) ~[?:?] at org.elasticsearch.xpack.ml.MachineLearning.createComponents(MachineLearning.java:370) ~[?:?] at org.elasticsearch.node.Node.lambda$new$7(Node.java:405) ~[elasticsearch-6.3.2.jar:6.3.2] at org.elasticsearch.node.Node$$Lambda$1401/33475076.apply(Unknown Source) ~[?:?] at java.util.stream.ReferencePipeline$7$1.accept(Unknown Source) ~[?:1.8.0_25] at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(Unknown Source) ~[?:1.8.0_25] at java.util.stream.AbstractPipeline.copyInto(Unknown Source) ~[?:1.8.0_25] at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) ~[?:1.8.0_25] at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source) ~[?:1.8.0_25] at java.util.stream.AbstractPipeline.evaluate(Unknown Source) ~[?:1.8.0_25] at java.util.stream.ReferencePipeline.collect(Unknown Source) ~[?:1.8.0_25] at org.elasticsearch.node.Node.(Node.java:408) ~[elasticsearch-6.3.2.jar:6.3.2] at org.elasticsearch.node.Node.(Node.java:252) ~[elasticsearch-6.3.2.jar:6.3.2] at org.elasticsearch.bootstrap.Bootstrap$5.(Bootstrap.java:213) ~[elasticsearch-6.3.2.jar:6.3.2] at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:213) ~[elasticsearch-6.3.2.jar:6.3.2] at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:326) [elasticsearch-6.3.2.jar:6.3.2] at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:136) [elasticsearch-6.3.2.jar:6.3.2] at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:127) [elasticsearch-6.3.2.jar:6.3.2] at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) [elasticsearch-6.3.2.jar:6.3.2] at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) [elasticsearch-cli-6.3.2.jar:6.3.2] at org.elasticsearch.cli.Command.main(Command.java:90) [elasticsearch-cli-6.3.2.jar:6.3.2] at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) [elasticsearch-6.3.2.jar:6.3.2] at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:86) [elasticsearch-6.3.2.jar:6.3.2] [2018-07-31T12:34:11,372][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [] uncaught exception in thread [main] org.elasticsearch.bootstrap.StartupException: ElasticsearchException[X-Pack is not supported and Machine Learning is not available for [windows-x86]; you can use the other X-Pack features (unsupported) by setting xpack.ml.enabled: false in elasticsearch.yml] at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:140) ~[elasticsearch-6.3.2.jar:6.3.2] at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:127) ~[elasticsearch-6.3.2.jar:6.3.2] at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.3.2.jar:6.3.2] at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.3.2.jar:6.3.2] at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-6.3.2.jar:6.3.2] at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) ~[elasticsearch-6.3.2.jar:6.3.2] at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:86) ~[elasticsearch-6.3.2.jar:6.3.2] Caused by: org.elasticsearch.ElasticsearchException: X-Pack is not supported and Machine Learning is not available for [windows-x86]; you can use the other X-Pack features (unsupported) by setting xpack.ml.enabled: false in elasticsearch.yml at org.elasticsearch.xpack.ml.MachineLearningFeatureSet.isRunningOnMlPlatform(MachineLearningFeatureSet.java:102) ~[?:?] at org.elasticsearch.xpack.ml.MachineLearningFeatureSet.isRunningOnMlPlatform(MachineLearningFeatureSet.java:93) ~[?:?] at org.elasticsearch.xpack.ml.MachineLearning.createComponents(MachineLearning.java:370) ~[?:?] at org.elasticsearch.node.Node.lambda$new$7(Node.java:405) ~[elasticsearch-6.3.2.jar:6.3.2] at org.elasticsearch.node.Node$$Lambda$1401/33475076.apply(Unknown Source) ~[?:?] at java.util.stream.ReferencePipeline$7$1.accept(Unknown Source) ~[?:1.8.0_25] at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(Unknown Source) ~[?:1.8.0_25] at java.util.stream.AbstractPipeline.copyInto(Unknown Source) ~[?:1.8.0_25] at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) ~[?:1.8.0_25] at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source) ~[?:1.8.0_25] at java.util.stream.AbstractPipeline.evaluate(Unknown Source) ~[?:1.8.0_25] at java.util.stream.ReferencePipeline.collect(Unknown Source) ~[?:1.8.0_25] at org.elasticsearch.node.Node.(Node.java:408) ~[elasticsearch-6.3.2.jar:6.3.2] at org.elasticsearch.node.Node.(Node.java:252) ~[elasticsearch-6.3.2.jar:6.3.2] at org.elasticsearch.bootstrap.Bootstrap$5.(Bootstrap.java:213) ~[elasticsearch-6.3.2.jar:6.3.2] at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:213) ~[elasticsearch-6.3.2.jar:6.3.2] at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:326) ~[elasticsearch-6.3.2.jar:6.3.2] at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:136) ~[elasticsearch-6.3.2.jar:6.3.2] ... 6 more [2018-07-31T13:16:54,014][INFO ][o.e.n.Node ] [] initializing ... [2018-07-31T13:16:54,092][INFO ][o.e.e.NodeEnvironment ] [G_YkjaN] using [1] data paths, mounts [[Windows (C:)]], net usable_space [471.2mb], net total_space [100gb], types [NTFS] [2018-07-31T13:16:54,092][INFO ][o.e.e.NodeEnvironment<br> ] [G_YkjaN] heap size [998.4mb], compressed ordinary object pointers [unknown] [2018-07-31T13:16:54,092][INFO ][o.e.n.Node ] [G_YkjaN] node name derived from node ID [G_YkjaN2T66OvWgjV9A6uQ]; set [node.name] to override [2018-07-31T13:16:54,092][INFO ][o.e.n.Node<br> ] [G_YkjaN] version[6.3.2], pid[8796], build[default/zip/053779d/2018-07-20T05:20:23.451332Z], OS[Windows 8.1/6.3/x86], JVM[Oracle Corporation/Java HotSpot(TM) Client VM/1.8.0_25/25.25-b02] [2018-07-31T13:16:54,092][INFO ][o.e.n.Node<br> ] [G_YkjaN] JVM arguments [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.io.tmpdir=C:\Users agkatke\AppData\Local\Temp\elasticsearch, -XX:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -XX:+PrintGCDetails, -XX:+PrintGCDateStamps, -XX:+PrintTenuringDistribution, -XX:+PrintGCApplicationStoppedTime, -Xloggc:logs/gc.log, -XX:+UseGCLogFileRotation, -XX:NumberOfGCLogFiles=32, -XX:GCLogFileSize=64m, -Delasticsearch, -Des.path.home=C:\elasticsearch-6.3.2, -Des.path.conf=C:\elasticsearch-6.3.2\config, -Des.distribution.flavor=default, -Des.distribution.type=zip] [2018-07-31T13:16:56,395][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [aggs-matrix-stats] [2018-07-31T13:16:56,395][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [analysis-common] [2018-07-31T13:16:56,395][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [ingest-common] [2018-07-31T13:16:56,395][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [lang-expression] [2018-07-31T13:16:56,395][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [lang-mustache] [2018-07-31T13:16:56,395][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [lang-painless] [2018-07-31T13:16:56,395][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [mapper-extras] [2018-07-31T13:16:56,395][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [parent-join] [2018-07-31T13:16:56,395][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [percolator] [2018-07-31T13:16:56,395][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [rank-eval] [2018-07-31T13:16:56,395][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [reindex] [2018-07-31T13:16:56,395][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [repository-url] [2018-07-31T13:16:56,395][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [transport-netty4] [2018-07-31T13:16:56,395][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [tribe] [2018-07-31T13:16:56,395][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [x-pack-core] [2018-07-31T13:16:56,395][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [x-pack-deprecation] [2018-07-31T13:16:56,395][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [x-pack-graph] [2018-07-31T13:16:56,395][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [x-pack-logstash] [2018-07-31T13:16:56,395][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [x-pack-ml] [2018-07-31T13:16:56,395][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [x-pack-monitoring] [2018-07-31T13:16:56,411][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [x-pack-rollup] [2018-07-31T13:16:56,411][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [x-pack-security] [2018-07-31T13:16:56,411][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [x-pack-sql] [2018-07-31T13:16:56,411][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [x-pack-upgrade] [2018-07-31T13:16:56,411][INFO ][o.e.p.PluginsService ] [G_YkjaN] loaded module [x-pack-watcher] [2018-07-31T13:16:56,411][INFO ][o.e.p.PluginsService ] [G_YkjaN] no plugins loaded [2018-07-31T13:17:00,453][INFO ][o.e.x.s.a.s.FileRolesStore] [G_YkjaN] parsed [0] roles from file [C:\elasticsearch-6.3.2\config oles.yml] [2018-07-31T13:17:00,828][ERROR][o.e.b.Bootstrap ] Exception org.elasticsearch.ElasticsearchException: X-Pack is not supported and Machine Learning is not available for [windows-x86]; you can use the other X-Pack features (unsupported) by setting xpack.ml.enabled: false in elasticsearch.yml at org.elasticsearch.xpack.ml.MachineLearningFeatureSet.isRunningOnMlPlatform(MachineLearningFeatureSet.java:102) ~[?:?] at org.elasticsearch.xpack.ml.MachineLearningFeatureSet.isRunningOnMlPlatform(MachineLearningFeatureSet.java:93) ~[?:?] at org.elasticsearch.xpack.ml.MachineLearning.createComponents(MachineLearning.java:370) ~[?:?] at org.elasticsearch.node.Node.lambda$new$7(Node.java:405) ~[elasticsearch-6.3.2.jar:6.3.2] at org.elasticsearch.node.Node$$Lambda$1401/26927529.apply(Unknown Source) ~[?:?] at java.util.stream.ReferencePipeline$7$1.accept(Unknown Source) ~[?:1.8.0_25] at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(Unknown Source) ~[?:1.8.0_25] at java.util.stream.AbstractPipeline.copyInto(Unknown Source) ~[?:1.8.0_25] at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) ~[?:1.8.0_25] at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source) ~[?:1.8.0_25] at java.util.stream.AbstractPipeline.evaluate(Unknown Source) ~[?:1.8.0_25] at java.util.stream.ReferencePipeline.collect(Unknown Source) ~[?:1.8.0_25] at org.elasticsearch.node.Node.(Node.java:408) ~[elasticsearch-6.3.2.jar:6.3.2] at org.elasticsearch.node.Node.(Node.java:252) ~[elasticsearch-6.3.2.jar:6.3.2] at org.elasticsearch.bootstrap.Bootstrap$5.(Bootstrap.java:213) ~[elasticsearch-6.3.2.jar:6.3.2] at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:213) ~[elasticsearch-6.3.2.jar:6.3.2] at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:326) [elasticsearch-6.3.2.jar:6.3.2] at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:136) [elasticsearch-6.3.2.jar:6.3.2] at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:127) [elasticsearch-6.3.2.jar:6.3.2] at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) [elasticsearch-6.3.2.jar:6.3.2] at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) [elasticsearch-cli-6.3.2.jar:6.3.2] at org.elasticsearch.cli.Command.main(Command.java:90) [elasticsearch-cli-6.3.2.jar:6.3.2] at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) [elasticsearch-6.3.2.jar:6.3.2] at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:86) [elasticsearch-6.3.2.jar:6.3.2] [2018-07-31T13:17:00,843][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [] uncaught exception in thread [main] org.elasticsearch.bootstrap.StartupException: ElasticsearchException[X-Pack is not supported and Machine Learning is not available for [windows-x86]; you can use the other X-Pack features (unsupported) by setting xpack.ml.enabled: false in elasticsearch.yml] at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:140) ~[elasticsearch-6.3.2.jar:6.3.2] at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:127) ~[elasticsearch-6.3.2.jar:6.3.2] at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.3.2.jar:6.3.2] at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.3.2.jar:6.3.2] at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-6.3.2.jar:6.3.2] at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) ~[elasticsearch-6.3.2.jar:6.3.2] at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:86) ~[elasticsearch-6.3.2.jar:6.3.2] Caused by: org.elasticsearch.ElasticsearchException: X-Pack is not supported and Machine Learning is not available for [windows-x86]; you can use the other X-Pack features (unsupported) by setting xpack.ml.enabled: false in elasticsearch.yml at org.elasticsearch.xpack.ml.MachineLearningFeatureSet.isRunningOnMlPlatform(MachineLearningFeatureSet.java:102) ~[?:?] at org.elasticsearch.xpack.ml.MachineLearningFeatureSet.isRunningOnMlPlatform(MachineLearningFeatureSet.java:93) ~[?:?] at org.elasticsearch.xpack.ml.MachineLearning.createComponents(MachineLearning.java:370) ~[?:?] at org.elasticsearch.node.Node.lambda$new$7(Node.java:405) ~[elasticsearch-6.3.2.jar:6.3.2] at org.elasticsearch.node.Node$$Lambda$1401/26927529.apply(Unknown Source) ~[?:?] at java.util.stream.ReferencePipeline$7$1.accept(Unknown Source) ~[?:1.8.0_25] at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(Unknown Source) ~[?:1.8.0_25] at java.util.stream.AbstractPipeline.copyInto(Unknown Source) ~[?:1.8.0_25] at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) ~[?:1.8.0_25] at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source) ~[?:1.8.0_25] at java.util.stream.AbstractPipeline.evaluate(Unknown Source) ~[?:1.8.0_25] at java.util.stream.ReferencePipeline.collect(Unknown Source) ~[?:1.8.0_25] at org.elasticsearch.node.Node.(Node.java:408) ~[elasticsearch-6.3.2.jar:6.3.2] at org.elasticsearch.node.Node.(Node.java:252) ~[elasticsearch-6.3.2.jar:6.3.2] at org.elasticsearch.bootstrap.Bootstrap$5.(Bootstrap.java:213) ~[elasticsearch-6.3.2.jar:6.3.2] at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:213) ~[elasticsearch-6.3.2.jar:6.3.2] at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:326) ~[elasticsearch-6.3.2.jar:6.3.2] at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:136) ~[elasticsearch-6.3.2.jar:6.3.2] ... 6 more</p> </blockquote> </div>

elasticsearch java 获取client速度很慢

大家好,初学elasticsearch使用版本为1.7.0,java程序每次获取client平均需要3S,这样用搜索的意义就没有了。 看了看网上的帖子说client做成单例模式,每次不关闭client,可是做成单例模式不关闭client,es的控制台会报错,但是client还可以继续使用。 请问大家有没有碰到类似的问题? 获取client代码如下: ``` private static final Log log = LogFactory.getLog(ElasticService.class); private static Settings settings = ImmutableSettings.settingsBuilder().put("client.transport.ping_timeout", "10s").put("client.transport.sniff", "true").build(); private TransportClient searchClient = null; public TransportClient getElasticClient() throws Exception{ /** * 你可以设置client.transport.sniff为true来使客户端去嗅探整个集群的状态, * 把集群中其它机器的ip地址加到客户端中,这样做的好处是一般你不用手动设置集群里所有集群的ip到连接客户端, * 它会自动帮你添加,并且自动发现新加入集群的机器。 */ try { Class clazz = Class.forName(TransportClient.class.getName()); Constructor constructor = clazz.getDeclaredConstructor(new Class[] { Settings.class }); constructor.setAccessible(true); searchClient = ((TransportClient) constructor.newInstance(new Object[] { settings })); searchClient.addTransportAddress(new InetSocketTransportAddress("127.0.0.1", 9300)); return searchClient; } catch (Exception e) { log.error("elasticSearch Client init error :"+e); throw new RuntimeException("elasticSearch Client init error", e); } } ``` 请问大家是怎么做的? 就这么多分了····都贡献了。 求代码,求版本····

大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了

大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

程序员请照顾好自己,周末病魔差点一套带走我。

程序员在一个周末的时间,得了重病,差点当场去世,还好及时挽救回来了。

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...

点沙成金:英特尔芯片制造全过程揭密

“亚马逊丛林里的蝴蝶扇动几下翅膀就可能引起两周后美国德州的一次飓风……” 这句人人皆知的话最初用来描述非线性系统中微小参数的变化所引起的系统极大变化。 而在更长的时间尺度内,我们所生活的这个世界就是这样一个异常复杂的非线性系统…… 水泥、穹顶、透视——关于时间与技艺的蝴蝶效应 公元前3000年,古埃及人将尼罗河中挖出的泥浆与纳特龙盐湖中的矿物盐混合,再掺入煅烧石灰石制成的石灰,由此得来了人...

讲一个程序员如何副业月赚三万的真实故事

loonggg读完需要3分钟速读仅需 1 分钟大家好,我是你们的校长。我之前讲过,这年头,只要肯动脑,肯行动,程序员凭借自己的技术,赚钱的方式还是有很多种的。仅仅靠在公司出卖自己的劳动时...

上班一个月,后悔当初着急入职的选择了

最近有个老铁,告诉我说,上班一个月,后悔当初着急入职现在公司了。他之前在美图做手机研发,今年美图那边今年也有一波组织优化调整,他是其中一个,在协商离职后,当时捉急找工作上班,因为有房贷供着,不能没有收入来源。所以匆忙选了一家公司,实际上是一个大型外包公司,主要派遣给其他手机厂商做外包项目。**当时承诺待遇还不错,所以就立马入职去上班了。但是后面入职后,发现薪酬待遇这块并不是HR所说那样,那个HR自...

女程序员,为什么比男程序员少???

昨天看到一档综艺节目,讨论了两个话题:(1)中国学生的数学成绩,平均下来看,会比国外好?为什么?(2)男生的数学成绩,平均下来看,会比女生好?为什么?同时,我又联想到了一个技术圈经常讨...

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

我说我不会算法,阿里把我挂了。

不说了,字节跳动也反手把我挂了。

优雅的替换if-else语句

场景 日常开发,if-else语句写的不少吧??当逻辑分支非常多的时候,if-else套了一层又一层,虽然业务功能倒是实现了,但是看起来是真的很不优雅,尤其是对于我这种有强迫症的程序"猿",看到这么多if-else,脑袋瓜子就嗡嗡的,总想着解锁新姿势:干掉过多的if-else!!!本文将介绍三板斧手段: 优先判断条件,条件不满足的,逻辑及时中断返回; 采用策略模式+工厂模式; 结合注解,锦...

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

为什么你不想学习?只想玩?人是如何一步一步废掉的

不知道是不是只有我这样子,还是你们也有过类似的经历。 上学的时候总有很多光辉历史,学年名列前茅,或者单科目大佬,但是虽然慢慢地长大了,你开始懈怠了,开始废掉了。。。 什么?你说不知道具体的情况是怎么样的? 我来告诉你: 你常常潜意识里或者心理觉得,自己真正的生活或者奋斗还没有开始。总是幻想着自己还拥有大把时间,还有无限的可能,自己还能逆风翻盘,只不是自己还没开始罢了,自己以后肯定会变得特别厉害...

男生更看重女生的身材脸蛋,还是思想?

往往,我们看不进去大段大段的逻辑。深刻的哲理,往往短而精悍,一阵见血。问:产品经理挺漂亮的,有点心动,但不知道合不合得来。男生更看重女生的身材脸蛋,还是...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试:第十六章:Java中级开发(16k)

HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

你打算用Java 8一辈子都不打算升级到Java 14,真香

我们程序员应该抱着尝鲜、猎奇的心态,否则就容易固步自封,技术停滞不前。

无代码时代来临,程序员如何保住饭碗?

编程语言层出不穷,从最初的机器语言到如今2500种以上的高级语言,程序员们大呼“学到头秃”。程序员一边面临编程语言不断推陈出新,一边面临由于许多代码已存在,程序员编写新应用程序时存在重复“搬砖”的现象。 无代码/低代码编程应运而生。无代码/低代码是一种创建应用的方法,它可以让开发者使用最少的编码知识来快速开发应用程序。开发者通过图形界面中,可视化建模来组装和配置应用程序。这样一来,开发者直...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

《经典算法案例》01-08:如何使用质数设计扫雷(Minesweeper)游戏

我们都玩过Windows操作系统中的经典游戏扫雷(Minesweeper),如果把质数当作一颗雷,那么,表格中红色的数字哪些是雷(质数)?您能找出多少个呢?文中用列表的方式罗列了10000以内的自然数、质数(素数),6的倍数等,方便大家观察质数的分布规律及特性,以便对算法求解有指导意义。另外,判断质数是初学算法,理解算法重要性的一个非常好的案例。

《Oracle Java SE编程自学与面试指南》最佳学习路线图(2020最新版)

正确选择比瞎努力更重要!

一文带你入门Java Stream流,太强了

两个星期以前,就有读者强烈要求我写一篇 Java Stream 流的文章,我说市面上不是已经有很多了吗,结果你猜他怎么说:“就想看你写的啊!”你看你看,多么苍白的喜欢啊。那就“勉为其难”写一篇吧,嘻嘻。 单从“Stream”这个单词上来看,它似乎和 java.io 包下的 InputStream 和 OutputStream 有些关系。实际上呢,没毛关系。Java 8 新增的 Stream 是为...

立即提问
相关内容推荐