# Getting Type Error but not setting a Type

**URL:** https://discuss.elastic.co/t/getting-type-error-but-not-setting-a-type/127215
**Category:** Logstash
**Created:** [April 8, 2018, 1:52pm UTC](https://discuss.elastic.co/t/getting-type-error-but-not-setting-a-type/127215 "2018-04-08T13:52:02Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![GregMeadows](https://avatars.discourse-cdn.com/v4/letter/g/b5e925/32.png) [@GregMeadows](https://discuss.elastic.co/u/GregMeadows)
#### Post date: [April 8, 2018, 1:52pm UTC](https://discuss.elastic.co/t/getting-type-error-but-not-setting-a-type/127215/1 "2018-04-08T13:52:02Z")

</div>

1. I've read the issues, solutions and blog article about removal of type fields
2. I am NOT SETTING A TYPE FIELD but still get a type error
3. I have a geo\_point type which I must create using an index template

The following no longer works  
STEP 1: Create index template to create geo\_point field (returns "success")  
STEP 2: Ingest using Logstash CONF file

ERROR: final mapping would have more than 1 type: [doc, map]"}

INDEX TEMPLATE

"greg-test": {  
"order": 0,  
"index\_patterns": [  
"greg\*",  
"gre\*"  
],  
"settings": {  
"index": {  
"number\_of\_shards": "1"  
}  
},  
"mappings": {  
"map": {  
"\_source": {  
"enabled": false  
},  
"properties": {  
"host\_name": {  
"type": "keyword"  
},  
"lid\_location": {  
"type": "geo\_point"  
}  
}  
}  
},  
"aliases": {}  
}  
}

CONF FILE

Output {  
elasticsearch {  
hosts =\> ["[http://localhost:9200](http://localhost:9200)"]  
index =\> "greg-test" }}

---

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [April 8, 2018, 3:49pm UTC](https://discuss.elastic.co/t/getting-type-error-but-not-setting-a-type/127215/2 "2018-04-08T15:49:49Z")

</div>

In your template you have created a type map, but since you are not setting a type on the output, the document\_type will default to doc. So you have two types, which is a problem.

I think you can fix this either by changing the mapping name in the template to doc (and creating a new index) or using the (deprecated) document\_type setting on the output.

---

<div class="post-metadata">

### Author: ![GregMeadows](https://avatars.discourse-cdn.com/v4/letter/g/b5e925/32.png) [@GregMeadows](https://discuss.elastic.co/u/GregMeadows)
#### Post date: [April 9, 2018, 12:37am UTC](https://discuss.elastic.co/t/getting-type-error-but-not-setting-a-type/127215/3 "2018-04-09T00:37:48Z")

</div>

thank you. corrected. same error even after correction. see below. All I need to know is this....what's the minimum example of an index template that sets a single field as geo\_point?

(Why can't logstash set a geo\_point field in the conf file via mutate option?)

HERE IS MY FAILED TEMPLATE  
Error message..."Rejecting mapping update to [geo-test] as the final mapping would have more than 1 type: [geo-test, doc]"

{  
"geo-test": {  
"order": 0,  
"index\_patterns": [  
"geo-test"  
],  
"settings": {},  
"mappings": {  
"doc": {  
"properties": {  
"lid\_location": {  
"type": "geo\_point"  
}  
}  
}  
},  
"aliases": {}  
}  
}

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [April 10, 2018, 6:30pm UTC](https://discuss.elastic.co/t/getting-type-error-but-not-setting-a-type/127215/4 "2018-04-10T18:30:09Z")

</div>

What operation resulted in the error message quoted above?

---

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [April 10, 2018, 6:51pm UTC](https://discuss.elastic.co/t/getting-type-error-but-not-setting-a-type/127215/5 "2018-04-10T18:51:52Z")

</div>

> [@GregMeadows](#):
>
> what's the minimum example of an index template that sets a single field as geo\_point?

How about this? Using match is a weird way to do it, but it was the simplest working example I had handy.

```auto
{
  "order": 0,
  "version": 3,
  "template": "nypd-complaints",
  "settings": {
    "number_of_shards": 1
  },
  "mappings": {
    "_default_": {
      "dynamic_templates": [
        {
          "locations": { 
            "match": "geolocation",
            "mapping": { "type": "geo_point" }
          }
        }
      ]
    }
  }
}

```

Which gets me a geo\_point

![AA1](https://us1.discourse-cdn.com/elastic/original/3X/4/e/4ee1c0dff13817825221ab44b287ea4f154ba726.png)

---

<div class="post-metadata">

### Author: ![GregMeadows](https://avatars.discourse-cdn.com/v4/letter/g/b5e925/32.png) [@GregMeadows](https://discuss.elastic.co/u/GregMeadows)
#### Post date: [April 10, 2018, 7:20pm UTC](https://discuss.elastic.co/t/getting-type-error-but-not-setting-a-type/127215/6 "2018-04-10T19:20:17Z")

</div>

Operation generating the error was Logstash CSV filter...so Magnus will Logstash be able to simply set a field as geo\_point without using an index template to set a field as geo\_point?

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [April 10, 2018, 8:09pm UTC](https://discuss.elastic.co/t/getting-type-error-but-not-setting-a-type/127215/7 "2018-04-10T20:09:20Z")

</div>

> Operation generating the error was Logstash CSV filter...

No, that's not what I meant. Are you saying that it's when Logstash posts to Elasticsearch that you get the error? Please always quote error messages in full.

> so Magnus will Logstash be able to simply set a field as geo\_point without using an index template to set a field as geo\_point?

No. The index needs to be configured (via explicit mappings) that a particular field is a geo\_point field. This can be done via an index template, via mappings provided when the index is created, or via the put mapping API.

---

<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: [May 8, 2018, 8:09pm UTC](https://discuss.elastic.co/t/getting-type-error-but-not-setting-a-type/127215/8 "2018-05-08T20:09:26Z")

</div>

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