# EsHadoopIllegalArgumentException: Detected type name in resource On elastic 8.8.2

**URL:** https://discuss.elastic.co/t/eshadoopillegalargumentexception-detected-type-name-in-resource-on-elastic-8-8-2/339660
**Category:** Elasticsearch
**Tags:** es-hadoop
**Created:** [July 31, 2023, 8:01am UTC](https://discuss.elastic.co/t/eshadoopillegalargumentexception-detected-type-name-in-resource-on-elastic-8-8-2/339660 "2023-07-31T08:01:01Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Joachim\_Rodrigues](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joachim_rodrigues/32/97640_2.png) [@Joachim\_Rodrigues](https://discuss.elastic.co/u/Joachim_Rodrigues)
#### Post date: [July 31, 2023, 8:01am UTC](https://discuss.elastic.co/t/eshadoopillegalargumentexception-detected-type-name-in-resource-on-elastic-8-8-2/339660/1 "2023-07-31T08:01:01Z")

</div>

Hi  
I upgraded my elastic server fom 7.9.3 to 8.8.2

With my previous configuration :

```auto
    implementation("org.elasticsearch:elasticsearch-spark-20_2.11:7.9.3") {
        exclude("org.apache.spark")
    }

```

This code was working (Dynamic/multi resource):

```auto
    mySparkDataframe.saveToEs("indexname/{year}")

```

year is a field in my dataframe

But when i upgraded the elastic server to 8.8.2  
my new conf :

```auto
    implementation("org.elasticsearch:elasticsearch-spark-20_2.11:8.2.2") {
        exclude("org.apache.spark")
    }

```

But the same code throws this exception :

> User class threw exception: java.lang.Exception: Error(s) during treatment of stream data org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 4.0 failed 4 times, most recent failure: Lost task 0.3 in stage 4.0 (TID 1109, host executor 1): org.elasticsearch.hadoop.EsHadoopIllegalArgumentException: Detected type name in resource [mySparkDataframe/{year}]. Remove type name to continue.
> 
> at org.elasticsearch.hadoop.rest.Resource.(Resource.java:88)
> 
> at org.elasticsearch.hadoop.rest.RestService.createWriter(RestService.java:595)
> 
> at org.elasticsearch.spark.rdd.EsRDDWriter.write(EsRDDWriter.scala:71)
> 
> at org.elasticsearch.spark.rdd.EsSpark$$anonfun$doSaveToEs$1.apply(EsSpark.scala:108)
> 
> at org.elasticsearch.spark.rdd.EsSpark$$anonfun$doSaveToEs$1.apply(EsSpark.scala:108)
> 
> at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:90)
> 
> at org.apache.spark.scheduler.Task.run(Task.scala:121)
> 
> at org.apache.spark.executor.Executor$TaskRunner$$anonfun$10.apply(Executor.scala:408)
> 
> at org.apache.spark.util.Utils$.tryWithSafeFinally(Utils.scala:1405)
> 
> at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:414)
> 
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> 
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> 
> at java.lang.Thread.run(Thread.java:748)

Can anyone help ?

thanks

---

<div class="post-metadata">

### Author: ![Keith\_Massey](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/keith_massey/32/83666_2.png) [@Keith\_Massey](https://discuss.elastic.co/u/Keith_Massey)
#### Post date: [July 31, 2023, 9:27pm UTC](https://discuss.elastic.co/t/eshadoopillegalargumentexception-detected-type-name-in-resource-on-elastic-8-8-2/339660/2 "2023-07-31T21:27:19Z")

</div>

Hi @Joachim_Rodrigues. It looks like you were using Elasticsearch types (maybe not intentionally?). Elastic began planning to remove them back in 5.0. As of 7.0 I think that support for them was pretty much gone, but most APIs didn't blow up if they were present. As of 8.0 they are no longer supported at all.  
You can read a little more about the removal of support for types over time in:

- [Removal of mapping types in Elasticsearch 6.0 | Elastic Blog](https://www.elastic.co/blog/removal-of-mapping-types-elasticsearch)
- [Moving from types to typeless APIs in Elasticsearch 7.0 | Elastic Blog](https://www.elastic.co/blog/moving-from-types-to-typeless-apis-in-elasticsearch-7-0)
- [Removal of mapping types | Elasticsearch Guide [8.9] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/removal-of-types.html)

If you're just trying to make sure that data for different years goes into a different place, you might just consider changing your code to something like `mySparkDataframe.saveToEs("indexname-{year}")`. That would give you one index per year (rather than one type per year in a single index). Does that work? Or is there something else that you were getting from types?

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [August 29, 2023, 10:08am UTC](https://discuss.elastic.co/t/eshadoopillegalargumentexception-detected-type-name-in-resource-on-elastic-8-8-2/339660/4 "2023-08-29T10:08:54Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
