ElasticsearchIndexer needs some new property 6.1


(SatyaRaj) #1

Hi Team,

I'm trying to create a class to initialize my elastic indexing.

  1. What is the transport type that I can use to run this locally on fresh setup. (Local is no longer supported in 6.1.1)

  2. What are the mandatory properties in general on yml. Any sample set would help.

    24-Feb-2018 01:06:50.022 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [D:\Software\apache-tomcat-8.5.27\webapps\search-store.war]
    log4j:WARN No appenders could be found for logger (org.apache.commons.configuration.ConfigurationUtils).
    log4j:WARN Please initialize the log4j system properly.
    ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console...
    24-Feb-2018 01:07:09.956 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.listenerStart Exception sending context initialized event to listener instance of class [co.web.search.LifecycleListener]
    java.lang.ExceptionInInitializerError
    at co.web.search.LifecycleListener.contextInitialized(LifecycleListener.java:30)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4745)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5207)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:986)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1857)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    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:748)
    Caused by: java.lang.IllegalStateException: Unsupported transport.type []
    at org.elasticsearch.common.network.NetworkModule.getTransportSupplier(NetworkModule.java:210)
    at org.elasticsearch.node.Node.(Node.java:424)
    at org.elasticsearch.node.Node.(Node.java:245)
    at tv.myplex.services.search.base.PluginNode.(PluginNode.java:12)
    at tv.myplex.services.search.base.NodeIndexer.init(NodeIndexer.java:53)
    at tv.myplex.services.search.base.NodeIndexer.(NodeIndexer.java:35)
    at tv.myplex.services.search.base.NodeIndexer.(NodeIndexer.java:30)
    ... 14 more

Thank you,
Regards,
SatyaRaj


(David Pilato) #2

Did you read: https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/index.html
?

BTW better to switch to the REST Client.


(SatyaRaj) #3

Hi Dadoonet,

Here is the code I'm using

String fileloc = ContentStoreConstants.ENV.getString(
					"elasticsearch.config.file.path",
					"D:/etc/myplex/content-store/elasticsearch.yml");
			FileInputStream inputStream = new FileInputStream(fileloc);
			source = IOUtils.toString(inputStream, "utf-8");
			Settings settings = Settings.builder()
					.loadFromSource(source, XContentType.YAML).build();

elasticsearch.yml

path.home: D:\Software\elasticsearch-6.1.1\bin
node.name: Local-Client
http.port: 9200
http.enabled: true
discovery.zen.ping.unicast.hosts: ["localhost[9300-9304]"]
logger.discovery: TRACE

Also Please suggest me a restclient sample link.

I found the following but still need some sample to convert my snippet above
https://artifacts.elastic.co/javadoc/org/elasticsearch/client/elasticsearch-rest-client-sniffer/6.2.2/org/elasticsearch/client/sniff/package-summary.html

Thank you,
Regards,
SatyaRaj


(David Pilato) #4

There is no mention in the doc I linked to about anything that look like what you pasted.
Did you read the documentation I linked to?

About the REST Client, it's there: https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/index.html


(SatyaRaj) #5

Hi Dadoonet,

finally I'm able to figure out, the InetSocketTransportAddress is causing this.
Followed the example as it is instead of using yml. Following are the properties I used.

.put("cluster.name", "elasticsearch")
					.put("path.home","D:\\Software\\elasticsearch-5.6.0\\bin")
					.put("transport.type","local")
					.put("http.enabled","false")
					.build();

Thank you,
Regards,
SatyaRaj


(system) #6

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.