You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/main/asciidoc/reference/elasticsearch-object-mapping.adoc
+7-5
Original file line number
Diff line number
Diff line change
@@ -56,16 +56,18 @@ Default value is _EXTERNAL_.
56
56
Constructor arguments are mapped by name to the key values in the retrieved Document.
57
57
* `@Field`: Applied at the field level and defines properties of the field, most of the attributes map to the respective https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping.html[Elasticsearch Mapping] definitions (the following list is not complete, check the annotation Javadoc for a complete reference):
58
58
** `name`: The name of the field as it will be represented in the Elasticsearch document, if not set, the Java field name is used.
59
-
** `type`: the field type, can be one of _Text, Keyword, Long, Integer, Short, Byte, Double, Float, Half_Float, Scaled_Float, Date, Date_Nanos, Boolean, Binary, Integer_Range, Float_Range, Long_Range, Double_Range, Date_Range, Ip_Range, Object, Nested, Ip, TokenCount, Percolator, Flattened, Search_As_You_Type_.
59
+
** `type`: The field type, can be one of _Text, Keyword, Long, Integer, Short, Byte, Double, Float, Half_Float, Scaled_Float, Date, Date_Nanos, Boolean, Binary, Integer_Range, Float_Range, Long_Range, Double_Range, Date_Range, Ip_Range, Object, Nested, Ip, TokenCount, Percolator, Flattened, Search_As_You_Type_.
60
60
See https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-types.html[Elasticsearch Mapping Types]
61
-
** `format` and `pattern` definitions for the _Date_ type.
61
+
** `format`: One or more built-in formats, default value is _strict_date_optional_time_ and _epoch_millis_.
62
+
See https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-date-format.html#built-in-date-formats[Elasticsearch Built In Formats]
63
+
** `pattern`: One or more custom date formats. NOTE: If you want to use only custom date formats, you must set the `format` property to empty `{}`.
64
+
See https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-date-format.html#custom-date-formats[Elasticsearch Custom Date Formats]
62
65
** `store`: Flag whether the original field value should be store in Elasticsearch, default value is _false_.
63
66
** `analyzer`, `searchAnalyzer`, `normalizer` for specifying custom analyzers and normalizer.
64
-
* `@GeoPoint`: marks a field as _geo_point_ datatype.
67
+
* `@GeoPoint`: Marks a field as _geo_point_ datatype.
65
68
Can be omitted if the field is an instance of the `GeoPoint` class.
66
69
67
-
NOTE: Properties that derive from `TemporalAccessor` or are of type `java.util.Date` must either have a `@Field` annotation of type `FieldType.Date` and a
68
-
format different from `DateFormat.none` or a custom converter must be registered for this type. +
70
+
NOTE: Properties that derive from `TemporalAccessor` or are of type `java.util.Date` must either have a `@Field` annotation of type `FieldType.Date`.
69
71
If you are using a custom date format, you need to use _uuuu_ for the year instead of _yyyy_.
70
72
This is due to a https://www.elastic.co/guide/en/elasticsearch/reference/current/migrate-to-java-time.html#java-time-migration-incompatible-date-formats[change in Elasticsearch 7].
Copy file name to clipboardExpand all lines: src/main/java/org/springframework/data/elasticsearch/core/mapping/SimpleElasticsearchPersistentProperty.java
if (dateFormats.length == 0 && dateFormatPatterns.length == 0) {
162
165
LOGGER.warn(
163
-
String.format("No DateFormat defined for property %s. Make sure you have a Converter registered for %s",
164
-
property, actualType.getSimpleName()));
166
+
"Property '{}' has @Field type '{}' but has no built-in format or custom date pattern defined. Make sure you have a converter registered for type {}.",
Copy file name to clipboardExpand all lines: src/test/java/org/springframework/data/elasticsearch/core/convert/ElasticsearchDateConverterUnitTests.java
Copy file name to clipboardExpand all lines: src/test/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverterUnitTests.java
0 commit comments