<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Hi<br>
<br>
I finally managed to get an elasticsearch client connection
running, whereas the Java code is as follows:<br>
<br>
+import org.elasticsearch.client.RestClient;<br>
+import org.elasticsearch.client.Response;<br>
+import org.apache.http.HttpHost;<br>
+import org.apache.http.Header;<br>
+import org.apache.http.message.BasicHeader;<br>
<br>
+ // TODO: Make sure to configure certificate
inside truststore, see
<a class="moz-txt-link-freetext" href="http://www.yanel.org/en/documentation/security/ssl.html">http://www.yanel.org/en/documentation/security/ssl.html</a><br>
+ String host =
"MY_HOST_ID.us-east-1.aws.found.io";<br>
+ int port = 9243;<br>
+ String protocol = "https";<br>
+ RestClient restClient =
RestClient.builder(new HttpHost(host, port, protocol)).build();<br>
+ String username = "elastic";<br>
+ String password = "MY_PASSWORD";<br>
+ Header header = new
BasicHeader("Authorization", getBasicAuthHeaderValue(username,
password));<br>
+<br>
+ log.debug("Access Elasticsearch ...");<br>
+ Response response =
restClient.performRequest("GET",
"/yulup/_search?q=repository-url:'hugo'", header);<br>
+ //Response response =
restClient.performRequest("GET",
"/yulup/_search?q=repository-url:'https\\:\\/\\/github.com\\/wyona\\/yanel'");<br>
+ restClient.close();<br>
+ } catch(Exception e) {<br>
+ log.error(e, e);<br>
+ }<br>
<br>
+ private String getBasicAuthHeaderValue(String username,
String password) {<br>
+ String auth = username + ":" + password;<br>
+ byte[] encodedAuth =
org.apache.commons.codec.binary.Base64.encodeBase64(auth.getBytes(java.nio.charset.Charset.forName("ISO-8859-1")));<br>
+ return "Basic " + new String(encodedAuth);<br>
+ }<br>
<br>
whereas re SSL one has to configure a truststore, whereas first
one needs to get the SSL certificate:<br>
<br>
<br>
openssl s_client -showcerts -connect
MY_HOST_ID.us-east-1.aws.found.io:9243 </dev/null
2>/dev/null|openssl x509 -outform PEM >elasticsearch.pem<br>
<br>
and then create the truststore file<br>
<br>
keytool -importcert -v -alias elasticsearch -file
elasticsearch.pem -storepass SOME_PASSWORD -keystore
truststore.jks<br>
<br>
and then configure this according to<br>
<br>
<a class="moz-txt-link-freetext" href="http://www.yanel.org/en/documentation/security/ssl.html">http://www.yanel.org/en/documentation/security/ssl.html</a><br>
<br>
If I find the time, then I will make this available inside Yanel
itself.<br>
<br>
Hope that helps<br>
<br>
Michael<br>
<br>
Am 15.08.17 um 17:35 schrieb Michael Wechner:<br>
</div>
<blockquote cite="mid:599314B8.1080902@wyona.com" type="cite">
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
<div class="moz-cite-prefix">Hi Balz<br>
<br>
Thanks very much for your feedback!<br>
<br>
I just found an alternative Elasticsearch client, which has no
Lucene dependencies<br>
<br>
<a moz-do-not-send="true" class="moz-txt-link-freetext"
href="https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/_initialization.html">https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/_initialization.html</a><br>
<br>
but I think we should upgrade Lucene anyway and your suggestions
below make a lot of sense!<br>
<br>
Thanks very much<br>
<br>
Michael<br>
<br>
Am 15.08.17 um 17:02 schrieb basZero:<br>
</div>
<blockquote
cite="mid:CAOXzDSE7=sZ+9huE2-w=f6V4i3P-5_0NDG=iA6PiWsdU1aFfQQ@mail.gmail.com"
type="cite">
<div dir="ltr">Hurray!!!
<div>I proposed the same thing in 2013:</div>
<div><a moz-do-not-send="true"
href="https://github.com/wyona/yarep/issues/6">https://github.com/wyona/yarep/issues/6</a><br>
</div>
<div><br>
</div>
<div>It would be great to see Lucene 6 in yanel.</div>
<div><br>
</div>
<div>Regarding source code repository of yanel/yarep etc.,
here my thought:</div>
<div>- I would create a new branch "lucene2.9.2" in all
repositories of the current latest status. This way, people
who want to work with this latest version and lucene 2.9.2
can still get the code very easily.</div>
<div>- The master branch would then be upgraded to use Lucene
6.</div>
<div><br>
</div>
<div>Some other remarks:</div>
<div>- Lucene 6 runs on Java 1.8 or later. So make sure all
old dependencies are upgraded as well! (in all repositories
like yarep, security etc.)</div>
<div>- The index of 2.9.2 won't be compatible, Lucene only
guarantees compatibility within the same major release (e.g.
6.0.0 and 6.6.0 will have the same index format).</div>
<div><br>
</div>
<div>The upgrade must be done carefully, because I currently
don't see what libraries Lucene is depending on (e.g. Log4j,
apache commons stuff...), I assume that many libs currently
in yanel (which are out of date) will have to be upgraded as
well. Example: yanel uses log4j 2.0 beta8 ... Lucene 6 will
most probably not use a beta version :-) so an upgrade to
log4j 2.5 is most probably required.</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>Cheers, Balz</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Tue, Aug 15, 2017 at 4:45 PM,
Michael Wechner <span dir="ltr"><<a
moz-do-not-send="true"
class="moz-txt-link-abbreviated"
href="mailto:michael.wechner@wyona.com"><a class="moz-txt-link-abbreviated" href="mailto:michael.wechner@wyona.com">michael.wechner@wyona.com</a></a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">Hi Together<br>
<br>
I have recently tried to integrate Elasticsearch into
Yanel, but have<br>
trouble doing this, because Elasticsearch requires a
more recent Lucene<br>
version than Yarep is using (2.9.2).<br>
<br>
<br>
Lucene already offers version 6.6.0<br>
(<a moz-do-not-send="true"
href="https://lucene.apache.org/core/downloads.html"
rel="noreferrer" target="_blank">https://lucene.apache.org/cor<wbr>e/downloads.html</a>)
and I think it would be<br>
good to upgrade Lucene finally. I am not sure whether
search indices are<br>
still compatible, but one could re-generate a search
index.<br>
<br>
What do you think? Any objections?<br>
<br>
Thanks<br>
<span class="gmail-m_-8693688901927037883HOEnZb"><font
color="#888888"><br>
Michael<br>
<br>
<br>
--<br>
Yanel-development mailing list <a
moz-do-not-send="true"
class="moz-txt-link-abbreviated"
href="mailto:Yanel-development@wyona.com"><a class="moz-txt-link-abbreviated" href="mailto:Yanel-development@wyona.com">Yanel-development@wyona.com</a></a><br>
<a moz-do-not-send="true"
href="http://mx2.wyona.com/cgi-bin/mailman/listinfo/yanel-development"
rel="noreferrer" target="_blank">http://mx2.wyona.com/cgi-bin/m<wbr>ailman/listinfo/yanel-developm<wbr>ent</a><br>
</font></span></blockquote>
</div>
<br>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
</blockquote>
<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
</blockquote>
<br>
</body>
</html>