How to use Elasticsearch's range types with Spring Data Elasticsearch

Elasticsearch allows the data, that is stored in a document, to be not only of elementary types, but also of a range of types, see the documentation. With a short example I will explain this range type and how to use it in Spring Data Elasticsearch (the current version being 4.0.3). For this example we want be able to answer the question: “Who was president of the United States of America in the year X?

Search entities within a geographic distance with Spring Data Elasticsearch 4

A couple of months ago I published the post Using geo-distance sort in Spring Data Elasticsearch 4. In the comments there came up the question “What about searching within a distance?” Well, this is not supported by query derivation from the method name, but it can easily be done with a custom repository implementation (see the documentation for more information about that). I updated the example – which is available on GitHub – and will explain what is needed for this implementation.

mapjfx display problem on Windows 10 seems solved

For some time now there was a bug that the map was not displaying properly on some Windows systems, see mapjfx problems It seems this was because of a bug in the WebView from JavaFX Thanks to and investigating into this. This issue was fixed with JavaFX15, I tried this on a virtual machine with Windows10 and could not reproduce the error anymore. There is no need to update mapjfx to JavaFX15 (as macOS and *nix are not hit by this bug).

Use an index name defined by the entity to store data in Spring Data Elasticsearch 4.0

When using Spring Data Elasticsearch (I am referencing the current version 4.0.2), normally the name of the index where the documents are stored is taken from the @Document annotation of the entity class – here it’s books: @Document(indexName="books") public class Book { // ... } Recently in a discussion of a Pull Request in Spring Data Elasticsearch, someone told that she needed a possibility to extract the name from the entity itself, as entities might go to different indices.

mapjfx 2.15.0 and 1.33.0 released adding circles and OpenLayers 6.4.2

I just released mapjfx versions 1.33.0 and 2.15.0, they will be available in maven central: <dependency> <groupId>com.sothawo</groupId> <artifactId>mapjfx</artifactId> <version>1.33.0</version> </dependency> <dependency> <groupId>com.sothawo</groupId> <artifactId>mapjfx</artifactId> <version>2.15.0</version> </dependency> 1.33.0 is built using Java 8 and 2.15.0 uses Java 11. Circles can now be added to a map, giving the center coordinates and the radius in meters with custom coloring and transparency, thanks to Hanwoo Kim for this contribution! The OpenLayers version now is 6.

How to provide a dynamic index name in Spring Data Elasticsearch using SpEL

In Spring Data Elasticsearch – at the time of writing, version 4.0 is the current version – the name of an index is normally defined by the @Document annotation on the entity class. For the following examples let’s assume we want to write some log entries to Elasticsearch with our application. We use the following entity: @Document(indexName = "log") public class LogEntity { @Id private String id = UUID.randomUUID().toString(); @Field(type = FieldType.

Using geo-distance sort in Spring Data Elasticsearch 4

The release of Spring Data Elasticsearch in version 4.0 (see the documentation) brings two new features that now enable users to use geo-distance sorts in repository queries: The first is a new class GeoDistanceOrder and the second is a new return type for repository methods SearchHit<T>. In this post I will show how easy it is to use these classes to answer questions like “Which pubs are the nearest to a given location?

mapjfx display problems update

For the last two years a problem was coming up occasionally with some users, that only the top left area of the map is displayed, and the rest is not loading: Thanks to the analysis of Martin Stiel in a comment and Victor Ewert in issue 81 it seems that this can be traced to a problem when running the application on a high resolution display. Alas I cannot reproduce this as I have no hardware with a resolution that might be high enough.

mapjfx 1.32.0 and 2.14.0 adds the ability to rotate markers and labels

I just released mapjfx versions 1.32.0 and 2.14.0, they will be available in maven central: <dependency> <groupId>com.sothawo</groupId> <artifactId>mapjfx</artifactId> <version>1.32.0</version> </dependency> <dependency> <groupId>com.sothawo</groupId> <artifactId>mapjfx</artifactId> <version>2.14.0</version> </dependency> 1.32.0 is built using Java 8 and 2.14.0 uses Java 11. Markers and Labels on a map now have a rotation property which will rotate the corresponding HTML Element. The values goes from 0 to 360 and defines the rotating angle clockwise.

Talking at Spring I/O 2020

After working on Spring Data Elasticsearch for nearly a year now, I’m proud that I will have a talk “Next Level Elasticsearch Integration with Spring Data Elasticsearch” at Spring I/O 2020 in Barcelona! Edit: Spring I/O is postponed to October 2020 due to Covid-19. Edit 2: Alas the conferebnce was cancelled.