Class ElasticsearchCollectionValueToStringConverter
java.lang.Object
org.springframework.data.elasticsearch.repository.support.value.ElasticsearchCollectionValueToStringConverter
- All Implemented Interfaces:
GenericConverter
public class ElasticsearchCollectionValueToStringConverter
extends Object
implements GenericConverter
Convert a collection into string for value part of the elasticsearch query.
If the value is type String, it should be wrapped with square brackets, with each element quoted therefore
escaped(by ElasticsearchStringValueToStringConverter) if quotations exist in the original element.
eg: The value part of an elasticsearch terms query should looks like ["hello \"Stranger\"","Another string"]
for query
{
"bool":{
"must":{
"terms":{
"name": ["hello \"Stranger\"", "Another string"]
}
}
}
}
- Since:
- 5.3
- Author:
- Haibo Liu
-
Nested Class Summary
Nested classes/interfaces inherited from interface GenericConverter
GenericConverter.ConvertiblePair -
Constructor Summary
ConstructorsConstructorDescriptionElasticsearchCollectionValueToStringConverter(ConversionService conversionService) -
Method Summary
Modifier and TypeMethodDescription@Nullable Objectconvert(@Nullable Object source, TypeDescriptor sourceType, TypeDescriptor targetType)
-
Constructor Details
-
ElasticsearchCollectionValueToStringConverter
-
-
Method Details
-
getConvertibleTypes
- Specified by:
getConvertibleTypesin interfaceGenericConverter
-
convert
public @Nullable Object convert(@Nullable Object source, TypeDescriptor sourceType, TypeDescriptor targetType) - Specified by:
convertin interfaceGenericConverter
-