# Incomplete mapping info

**URL:** <https://discuss.elastic.co/t/incomplete-mapping-info/52232>\
**Category:** Elasticsearch\
**Created:** [June 8, 2016, 3:33pm UTC](https://discuss.elastic.co/t/incomplete-mapping-info/52232 "2016-06-08T15:33:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![peterk](https://avatars.discourse-cdn.com/v4/letter/p/7993a0/32.png) [@peterk](https://discuss.elastic.co/u/peterk)\
**Post date:** [June 8, 2016, 3:33pm UTC](https://discuss.elastic.co/t/incomplete-mapping-info/52232/1 "2016-06-08T15:33:06Z")

</div>

It seems to be impossible to query the mapping information of an explicitly defined index type.

Example:

type mapping in work\_mapping.json:

**... ----------------------------- begin example snipset ----------------------------**  
\*\* "person" : {\*\*  
\*\* "type" : "string",\*\*  
\*\* "index\_options" : "offsets"\*\*  
\*\* },\*\*  
\*\* "registrationStatus" : {\*\*  
\*\* "type" : "string",\*\*  
\*\* "index" : "no",\*\*  
**"norms": {**  
\*\* "enabled": false\*\*  
\*\* }\*\*  
\*\* },\*\*  
\*\* "title" : {\*\*  
\*\* "type" : "string",\*\*  
\*\* "index\_options" : "offsets"\*\*  
\*\* },\*\*  
\*\* "trigger" : {\*\*  
\*\* "type" : "string",\*\*  
\*\* "index" : "no",\*\*  
**"norms": {**  
\*\* "enabled": false\*\*  
\*\* }\*\*  
**... ----------------------------- end example snipset ----------------------------**

define mapping type:

**$ curl -XPUT '[http://localhost:9200/testindex/\_mapping/test](http://localhost:9200/testindex/_mapping/test)' --data-binary @work\_mapping.json**

after adding some documents I want to query the type mapping

**$ curl -XGET '[http://localhost:9200/testindex/\_mapping/test?pretty'|more](http://localhost:9200/testindex/_mapping/test?pretty'%7Cmore)**

**... ----------------------------- begin example snipset ----------------------------**  
\*\* "person" : {\*\*  
\*\* "type" : "string"\*\*  
\*\* },\*\*  
\*\* "registrationStatus" : {\*\*  
\*\* "type" : "string"\*\*  
\*\* },\*\*  
\*\* "title" : {\*\*  
\*\* "type" : "string"\*\*  
\*\* },\*\*  
\*\* "trigger" : {\*\*  
\*\* "type" : "string"\*\*  
\*\* },\*\*  
**... ----------------------------- end example snipset ----------------------------**

So I'm missing essential information about field definitions. Is this just a flaw in ES?

Kind Regards  
Peter

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [June 8, 2016, 6:20pm UTC](https://discuss.elastic.co/t/incomplete-mapping-info/52232/2 "2016-06-08T18:20:32Z")

</div>

Do you get back any errors when you execute

```auto
curl -XPUT 'http://localhost:9200/testindex/_mapping/test' 

```

If you do, your mapping is probably not getting applied and what you get is dynamically discovered mapping that is the result of you indexing the document.

It's hard to see from your example what you are actually sending as a mapping, could you edit your post using the following format?

````
```
your json 
goes here
```
````

---

<div class="post-metadata">

**Author:** ![peterk](https://avatars.discourse-cdn.com/v4/letter/p/7993a0/32.png) [@peterk](https://discuss.elastic.co/u/peterk)\
**Post date:** [June 9, 2016, 7:15am UTC](https://discuss.elastic.co/t/incomplete-mapping-info/52232/3 "2016-06-09T07:15:13Z")

</div>

bash-4.2$ curl -XPUT '[http://localhost:9200/testindex](http://localhost:9200/testindex)'  
{"acknowledged":true}bash-4.2$  
bash-4.2$ curl -XPUT '[http://localhost:9200/testindex/\_mapping/test](http://localhost:9200/testindex/_mapping/test)' --data-binary @work\_mapping.json  
{"acknowledged":true}bash-4.2$

another guess?

---

<div class="post-metadata">

**Author:** ![peterk](https://avatars.discourse-cdn.com/v4/letter/p/7993a0/32.png) [@peterk](https://discuss.elastic.co/u/peterk)\
**Post date:** [June 9, 2016, 7:33am UTC](https://discuss.elastic.co/t/incomplete-mapping-info/52232/4 "2016-06-09T07:33:02Z")

</div>

something must have happened - now it works!

> curl -XGET '[http://localhost:9200/testindex/\_mapping/test?pretty](http://localhost:9200/testindex/_mapping/test?pretty)'  
> ...  
> "person" : {  
> "type" : "string",  
> "index\_options" : "offsets"  
> },  
> "registrationStatus" : {  
> "type" : "string",  
> "index" : "no",  
> "norms" : {  
> "enabled" : false  
> }  
> },  
> "title" : {  
> "type" : "string",  
> "index\_options" : "offsets"  
> },  
> "trigger" : {  
> "type" : "string",  
> "index" : "no",  
> "norms" : {  
> "enabled" : false  
> }  
> },  
> ...

that's exactly what I would have expected. So it seems to work. Sorry for that - my fault 😟

Kind Regards  
Peter

---

<div class="post-metadata">

**Author:** ![peterk](https://avatars.discourse-cdn.com/v4/letter/p/7993a0/32.png) [@peterk](https://discuss.elastic.co/u/peterk)\
**Post date:** [June 9, 2016, 12:41pm UTC](https://discuss.elastic.co/t/incomplete-mapping-info/52232/5 "2016-06-09T12:41:50Z")

</div>

now I know what's gone wrong 🙂

so once again:

> # delete work index
> 
> bash-4.2$ curl -XDELETE "[http://localhost:9200/work](http://localhost:9200/work)"  
> {"acknowledged":true}

> # create new (empty) work index
> 
> bash-4.2$ curl -XPUT "[http://localhost:9200/work](http://localhost:9200/work)"  
> {"acknowledged":true}

> # show target mapping for test type
> 
> bash-4.2$ cat work\_test\_mapping.json  
> {  
> "test" : {  
> "dynamic": "strict",  
> "\_all" : {  
> "enabled" : false  
> },  
> "properties" : {  
> "dateAdded" : {  
> "type" : "string",  
> "index\_options" : "docs",  
> "norms": {  
> "enabled": false  
> }  
> },  
> "dateOfChange" : {  
> "type" : "date",  
> "format" : "strict\_date\_optional\_time||epoch\_millis",  
> "index" : "no",  
> "norms": {  
> "enabled": false  
> }  
> },  
> "person" : {  
> "type" : "string",  
> "index\_options" : "offsets"  
> },  
> "title" : {  
> "type" : "string",  
> "index\_options" : "offsets"  
> },  
> "trigger" : {  
> "type" : "string",  
> "index" : "no",  
> "norms": {  
> "enabled": false  
> }  
> },  
> "updateId" : {  
> "type" : "string",  
> "index\_options" : "docs",  
> "norms": {  
> "enabled": false  
> }  
> }  
> }  
> }  
> }

> # apply (strict) mapping
> 
> bash-4.2$ curl -XPUT '[http://localhost:9200/work/\_mapping/test](http://localhost:9200/work/_mapping/test)' --data-binary @work\_test\_mapping.json  
> {"acknowledged":true}

> # show results - looks good...
> 
> bash-4.2$ curl -XGET '[http://localhost:9200/work/\_mapping/test?pretty'|more](http://localhost:9200/work/_mapping/test?pretty'%7Cmore)  
> % Total % Received % Xferd Average Speed Time Time Time Current  
> Dload Upload Total Spent Left Speed  
> 100 1091 100 1091 0 0 139k 0 --:--:-- --:--:-- --:--:-- 152k  
> {  
> "work" : {  
> "mappings" : {  
> "test" : {  
> "dynamic" : "strict",  
> "\_all" : {  
> "enabled" : false  
> },  
> "properties" : {  
> "dateAdded" : {  
> "type" : "string",  
> "norms" : {  
> "enabled" : false  
> },  
> "index\_options" : "docs"  
> },  
> "dateOfChange" : {  
> "type" : "date",  
> "index" : "no",  
> "format" : "strict\_date\_optional\_time||epoch\_millis"  
> },  
> "person" : {  
> "type" : "string",  
> "index\_options" : "offsets"  
> },  
> "title" : {  
> "type" : "string",  
> "index\_options" : "offsets"  
> },  
> "trigger" : {  
> "type" : "string",  
> "index" : "no",  
> "norms" : {  
> "enabled" : false  
> }  
> },  
> "updateId" : {  
> "type" : "string",  
> "norms" : {  
> "enabled" : false  
> },  
> "index\_options" : "docs"  
> }  
> }  
> }  
> }  
> }  
> }

> # now feed some data
> 
> bash-4.2$ cat /media/sf\_common/work10.json |stream2es stdin --replace --target "[http://localhost:9200/work/test](http://localhost:9200/work/test)"  
> 2016-06-09T12:37:32.429+0000 INFO delete index [http://localhost:9200/work](http://localhost:9200/work)  
> 2016-06-09T12:37:33.041+0000 INFO 00:00,618 16,2d/s 4,8K/s (0,0mb) indexed 10 streamed 10 errors 0  
> 2016-06-09T12:37:33.043+0000 INFO done

> # show mapping again
> 
> bash-4.2$ curl -XGET '[http://localhost:9200/work/\_mapping/test?pretty'|more](http://localhost:9200/work/_mapping/test?pretty'%7Cmore)  
> % Total % Received % Xferd Average Speed Time Time Time Current  
> Dload Upload Total Spent Left Speed  
> 100 634 100 634 0 0 59845 0 --:--:-- --:--:-- --:--:-- 63400  
> {  
> "work" : {  
> "mappings" : {  
> "test" : {  
> "\_all" : {  
> "enabled" : false  
> },  
> "properties" : {  
> "dateAdded" : {  
> "type" : "string"  
> },  
> "dateOfChange" : {  
> "type" : "date",  
> "format" : "strict\_date\_optional\_time||epoch\_millis"  
> },  
> "person" : {  
> "type" : "string"  
> },  
> "title" : {  
> "type" : "string"  
> },  
> "trigger" : {  
> "type" : "string"  
> },  
> "updateId" : {  
> "type" : "string"  
> }  
> }  
> }  
> }  
> }  
> }  
> bash-4.2$

**As what you may have suspected, it was the "--replace" option of es2stream what did the damage 😪**

---

<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:** [July 5, 2017, 10:45pm UTC](https://discuss.elastic.co/t/incomplete-mapping-info/52232/6 "2017-07-05T22:45:02Z")

</div>


