Hello,
I'm encountering a co.elastic.clients.transport.TransportException
with the following error message:
co.elastic.clients.transport.TransportException: node: http://my-elasticsearch-project-c2b746.es.ap-southeast-1.aws.elastic.cloud:443/, status: 400, [es/index] Expecting JSON data but response content-type is: application/octet-stream
Environment Details:
- Elasticsearch Java Client Version: 8.12
- Spring Data Elasticsearch Version: 4.3.3
- Elasticsearch Server Version (AWS Elastic Cloud): I am using the default version of Elastic Cloud.
- Elasticsearch Cloud TLS enabled: I am using the default Elastic cloud configuration.
- Network Environment: I am using the default Elastic cloud configuration.
Configuration:
My Elasticsearch configuration is as follows:
@Configuration
class ElasticSearchConfig(
@Value("\${elasticsearch.api}") private val elasticsearchApiKey: String,
@Value("\${elasticsearch.url}") private val elasticsearchUrl: String,
) : ReactiveElasticsearchConfiguration() {
override fun clientConfiguration(): ClientConfiguration {
val client = ClientConfiguration.create(elasticsearchUrl).apply {
defaultHeaders.add(HttpHeaders.AUTHORIZATION, "ApiKey $elasticsearchApiKey")
}
return client
}
}
My application.properties
file contains:
elasticsearch.url=my-elasticsearch-project-c2b746.es.ap-southeast-1.aws.elastic.cloud:443
Problem:
- I'm receiving a 400 error with the
application/octet-stream
content type when attempting to index data. - If I change
elasticsearch.url
tohttps://my-elasticsearch-project-c2b746.es.ap-southeast-1.aws.elastic.cloud:443
, I receive anodename nor servname provided or not known
error. - I have already reviewed this previous discussion, but it did not provide a resolution: Node: http://boardoftrustees-elk.kb.westeurope.azure.elastic-cloud.com:9243/, status: 400, [es/indices.create] Expecting JSON data but response content-type is: application/octet-stream - #6 by dadoonet
Indexing Code
elasticsearchClient.index { it.index("product").document(product) }.id()
Index Mapping
@Document(indexName = "product", createIndex = true)
@Setting(settingPath = "settings.json")
data class Product(
@Field(type = FieldType.Keyword) var name: String,
@Field(type = FieldType.Text, analyzer = "synonym_analyzer") val description: String,
@Field(type = FieldType.Keyword) var categories: List<String> = listOf(),
@Field(type = FieldType.Keyword) var tags: List<String> = listOf(),
)
Could anyone provide insight into why I'm receiving this application/octet-stream
error and how to resolve it?
Thank you for your assistance.