https://sothawo.com
sothawo
sothawo sothawo software ( design | development | knowledge ) Menu Posts Projects About Contact Privacy policy Use Elasticsearch SQL with Spring Data Elasticsearch November 14, 2023Java, Programming, Spring, Spring Data Elasticsearch Motivation In Spring Data Elasticsearch recently a issue was raised to include to possibility to use Elasticsearch SQL . While it is easy with Spring Data Elasticsearch 5.1 to use this directly from within an application, the integration into Spring Data Elasticsearch is more complicated, as the returned values (column definitions and rows) cannot easily and automatically be mapped on to the entities that Spring Data works with, and the response might not only contain column definition, row values, but cursor information as well. Use two different Elasticsearch clusters with Spring Data Elasticsearch October 18, 2023Java, Programming, Spring, Spring Data Elasticsearch Motivation In the Spring Data Elasticsearch issue tracker recently someone asked if it is possible to access two different Elasticsearch clusters in an application that is using Spring Data Elasticsearch. The reason they needed this weas because that application should do some migration - I assume that data from one cluster should be transferred to a second cluster. In this blog post I will show how this can be set up. In this article I name the one cluster the default cluster and the other the secondary cluster. Simulate HTTP status 429 with OWASP ZAP June 05, 2023Network Why? When developing and testing code for Spring Data Elasticsearch I often use the OWASP ZAP proxy to monitor the data that is sent to and returned from Elasticsearch. I now had the situation that I needed to check how the library behaves when the server returns a code 429 (too many requests) status. Rather than trying to set up a test that tries to flood my local Elasticsearch instance, I decided to add a script to ZAP that automatically for a given percentage of requests returns that status. Download the list of followers from your Mastodon account May 07, 2023Python The Problem It recently came to my mind that it might be handy to have a list of all the accounts that I follow on Mastodon. I can surely see them on the web or in any decent client, but as a backup it would be great to have a list to store somewhere. As I already played a little with the Mastodon API I decided to write a short script that downloads a list of user@instance values. And as I am using Python only occasionally, I decided to do this script in Python. Get the history of commands that created a docker image May 05, 2023Note to Self Note to self: In order to see which commands (latest on top) were used to create a docker image run: docker history --no-trunc --format 'RUN {{.CreatedBy}}'
Migrate from Wordpress to Hugo May 01, 2023Categories Yesterday and today I migrated my web site / blog from Wordpress to Hugo . It was less effort and pain than I had anticipated. It was done with these steps: Install Hugo (I am running on macOS using macPorts, so: sudo port install hugo) In my wordpress installation, I aded the “Wordpress to Jekyll Exporter” plugin and exported the blog posts to a local zip file. After unzipping this file I ran hugo import jekyll jekyll-export hugo-sothawo to create the initial Hugo setup for my site Added this as git repository to a git repository hosted at my web hoster Cloned the Mainroad theme from GitHub and pushed my clone to a private git repo as well, as I have some adjustments to the theme. Adjusted the theme and its settings until I had it to my liking. Went through my pages and posts to clean up links that had the full path to my site in them (they will when deployed with Hugo, but that should not be in the code). Adapted the code snippets to the highlighting that Hugo uses. This was some time consuming stupid work. Created the deployment of my site with hugo Uploaded the public directory to my Hoster into a new directory servde from a test subdomain. Checked that all works. Changed the DNS settings to point to the new site. And here we go. No more PHP version updates, Wordpress or plugin security updates, database and file backups. Accessing a secured Elasticsearch 8.5 instance using Spring Data Elasticsearch 5.0 April 30, 2023Java, Programming, Spring, Spring Data Elasticsearch The problem When starting an Elasticsearch instance in version 8 (the current version being 8.7.0) for the first time, the Elasticsearch server is by default automatically configured with a random generated password and a self signed certificate to secure the connection between clients and the Elasticsearch server. The password and the fingerprint for the certificate are shown in the output of the server on the first start (output truncated for brevity): Reading different entities from multiple indices with one call using Spring Data Elasticsearch May 09, 2021Java, Programming, Spring, Spring Data Elasticsearch The problem In Elasticsearch (the the current version at the time of writing this post is 7.12.1) every index holds exactly one type of data. This type is defined by the index mapping which describes the fields of the index and their types. Spring Data Elasticsearch (the current version is 4.2) automatically maps between a Java class – the entity type – with its properties and the data in the Elasticsearch index. This means that when searching, the entity type must be specified. In Spring Data Repositories this is the type specified in the repository definition, when using the ElasticsearchOperations interface, the search function required a parameter specifying the class to return. The mystery of the endless Throwable's cause chain shown in the IntelliJ debugger April 16, 2021Java, Programming A Throwable in Java can have a cause which in turn is a Throwable as well. This cause can have a cause and we can have a chain of Throwableobjects which we can follow until a Throwable has no cause. Let me explain this with a small example: 1class Scratch { 2 public static void main(String[] args) { 3 try { 4 try { 5 int division = divide(4, 0); 6 } catch (Exception e) { 7 throw new IllegalArgumentException("got exception calling divide", e); 8 } 9 } catch (Throwable t) { 10 while (t != null) { 11 System.out.println(t.getClass().getCanonicalName()); 12 t = t.getCause(); 13 } 14 } 15 } 16 17 private static int divide(int divident, int divisor) { 18 return divident / divisor; 19 } 20} In this example we call a function to divide two numbers and pass in a divisor with value 0. This of course leads to an ArithmeticException which we catch and set as the cause for a new IllegalArgumentException. We then catch this new exception and print out the cause-chain . Running this program gives the expected result: show artillery http traffic April 16, 2021Programming Just playing with https://artillery.io/ . If you need to see which requests are sent during setting up your test script, set the DEBUG environment variable: DEBUG=http:request,http:response,http:full_body $(npm bin)/artillery run test.yml 1/14 » Recent Posts Use Elasticsearch SQL with Spring Data Elasticsearch Use two different Elasticsearch clusters with Spring Data Elasticsearch Simulate HTTP status 429 with OWASP ZAP Download the list of followers from your Mastodon account Get the history of commands that created a docker image Tags Airdrop (1) Akka (4) Annotation (1) Apache (3) Apache-Kafka (2) Apache2 (1) Artillery (1) Bing Maps (1) Cache (3) Camera (1) Certificate (2) Custom (1) Data-Uri (1) Debugger (1) Disk (1) Dns (1) Dnsmasq (1) Docker (2) Dsl (1) Error Recovery (1) Git (1) Growl (2) Hibernate (1) Hidden Files (1) Hosts (2) Httpie (1) Https (4) Hugo (1) I18n (1) Intellij (2) Java (35) Java11 (11) Java12 (2) Java8 (46) Javafx (60) Javafx8 (50) Javascript (1) Jax-Ws (3) Jpa2.1 (1) Jq (1) Jsoup (1) Keystore (2) Kotlin (3) Kubernetes (1) Logging (2) Logmanager (1) MacOS (1) Macports (2) Mail.app (1) Map (59) Mapjfx (65) Mastodon (1) Maven (3) Maven-Release-Plugin (1) Npe (1) Openlayers (60) Openshift (4) Osx (4) Owasp (1) Php (1) Push (1) Quarantine (1) Range (1) Reactive (1) Regexp (1) Regular Expression (1) Rest (1) Rxjava2 (1) Shred (1) Skype (1) Spel (1) Spring (13) Spring-Boot (10) Spring-Data-Elasticsearch (11) Sslcontext (1) Sudo (1) Test (1) Theme (1) Threads (1) Tld (1) Trakxmap (4) Truststore (2) Uri (1) Url (1) User-Agent (1) Vaadin (4) Vim (1) Webservice (3) Wipe (1) Wordpress (1) Xattr (1) Zap (1) Categories Akka 4 Java 104 Kotlin 3 Linux 1 Miscellaneous 5 Network 1 Note to Self 9 Operating Systems 1 OSX 15 Programming 107 Python 1 Spring 13 Spring Data Elasticsearch 10 Technology 1 Tools 1 Social pj.meisch@sothawo.com Mastodon GitHub © 2011-2025 sothawo. Generated with Hugo and an adapted Mainroad theme.enen1771603081https://sothawo.com
Sahypaňyzy redaktirläňmi?
Näme edýärsiň?