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 org.springframework.core.convert.converter.GenericConverter
GenericConverter.ConvertiblePair
-
Constructor Summary
ConstructorDescriptionElasticsearchCollectionValueToStringConverter
(ConversionService conversionService) -
Method Summary
Modifier and TypeMethodDescriptionconvert
(Object source, TypeDescriptor sourceType, TypeDescriptor targetType)
-
Constructor Details
-
ElasticsearchCollectionValueToStringConverter
-
-
Method Details
-
getConvertibleTypes
- Specified by:
getConvertibleTypes
in interfaceGenericConverter
-
convert
@Nullable public Object convert(@Nullable Object source, TypeDescriptor sourceType, TypeDescriptor targetType) - Specified by:
convert
in interfaceGenericConverter
-