# Wares Plugin : Dynamic & Config Mappings question

**URL:** <https://discuss.elastic.co/t/wares-plugin-dynamic-config-mappings-question/5460>\
**Category:** Elasticsearch\
**Created:** [September 27, 2011, 9:09am UTC](https://discuss.elastic.co/t/wares-plugin-dynamic-config-mappings-question/5460 "2011-09-27T09:09:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![antonio\_fernandez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/antonio_fernandez/32/3083_2.png) [@antonio\_fernandez](https://discuss.elastic.co/u/antonio_fernandez)\
**Post date:** [September 27, 2011, 9:09am UTC](https://discuss.elastic.co/t/wares-plugin-dynamic-config-mappings-question/5460/1 "2011-09-27T09:09:55Z")

</div>

Hi, this is my first post on this mailing list, Greetings from MÃ¡laga,  
Spain 😃

@shay : Congratulations, the ES approach seems very, very interesting.

A few notes :

- We find very attractive the ability to define mappings using JSON  
notation, which to my taste is lighter and easier to use XML files or  
Java APIs ( we previously had worked with Lucene API )

- In a first step of integration of ES we can not use their "distributed  
capabilities", due to restrictions on the intranet which hosts our  
application in production. We therefore we consider that the proposed  
NodeServlet Ware plugin is a perfect choise for us.

- NodeServlet : ItÂ´s clear that deploy it can no longer access the  
server on port 9200, but what happens to port 9300 ? , I ask because  
during the start we see the following messages :

9:46:03 - [Perfection] Bound to address [/ 0.0.0.0:9300]  
9:46:03 - [Perfection] {inet bound\_address [/ 0.0.0.0:9300]}, {inet  
publish\_address [/ 5.157.247.64:9300]}

- Dynamic / Config Mappings : In principle we see no need to disable  
dynamic mapping, we find it useful, but we also need to define our  
custom mappings for certain types of data. We believe we have a problem  
here, because seems that NodeServlet is not detecting our JSON config  
files :

We have the following files :

/ WEB-INF/config/default-mapping.json  
{  
"_default_" : {  
"date\_formats" : ["yyyyMMdd", "yyyy-MM-dd", "dd-MM-yyyy",  
"date\_optional\_time"]  
}  
}

/ WEB-INF/config/mappings/myindex/mytype-mapping.json  
{  
"mytype" : {  
"properties" : {  
"property1" : {  
"type" : "string"  
},  
"property2": {  
"type" : "boolean"  
}  
}  
}  
}

And here is the resulting logging :

Then we see the logging and ...

09:46:07 - [Perfection] [myindex] using dynamic[true], default mapping:  
location[null] and source[{  
"_default_" : {  
}  
}]  
09:46:07 - [Perfection] [myindex] using [resident] field cache with  
max\_size [-1], expire [null]  
09:46:07 - [Perfection] [myindex] Using stats.refresh\_interval [1s]  
09:46:07 - [Perfection] [myindex] adding mapping [mytype], source  
[{"mytype":{"dynamic\_date\_formats":["yyyyMMdd","yyyy-MM-dd","dd-MM-yyyy","date\_optional\_time"],"properties":{"property1":{"type":"string"},"property2":{"type":"string"}]  
09:46:07 - [Perfection] [myindex][0] creating shard

Here I could see two problems :

1. The logging about the default mappings says that there is no default  
config file, but my custom date format appears when the Node is logging  
the adding of a a mapping for 'mytype'
2. The logging make me suppose that the generated mapping related with  
'mytype' is provided by the dynamic.mapping feature, correct ? , Because  
IÂ´ve defined that "property2" field as boolean and seems itÂ´s not detected.

- We are using Eclipse Indigo + Tomcat 6.0 with WTP plugin , perhaps we  
are inside a "configuration madness" 🙂 ?

Thanks in advance for all,  
& Have a nice day

--  
Antonio Miguel FernÃ¡ndez RodrÃ­guez  
Jaraxa Software, SL  
[www.jaraxa.com](http://www.jaraxa.com)

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [September 27, 2011, 9:11pm UTC](https://discuss.elastic.co/t/wares-plugin-dynamic-config-mappings-question/5460/2 "2011-09-27T21:11:21Z")

</div>

2011/9/27 Antonio Fernández [antonio.fernandez@jaraxa.com](mailto:antonio.fernandez@jaraxa.com)

> \*\*
> 
> Hi, this is my first post on this mailing list, Greetings from Málaga,  
> Spain 😃
> 
> @shay : Congratulations, the ES approach seems very, very interesting.
> 
> A few notes :
> 
> - We find very attractive the ability to define mappings using JSON  
> notation, which to my taste is lighter and easier to use XML files or Java  
> APIs ( we previously had worked with Lucene API )
> 
> - In a first step of integration of ES we can not use their "distributed  
> capabilities", due to restrictions on the intranet which hosts our  
> application in production. We therefore we consider that the proposed  
> NodeServlet Ware plugin is a perfect choise for us.
> 
> - NodeServlet : It´s clear that deploy it can no longer access the server  
> on port 9200, but what happens to port 9300 ? , I ask because during the  
> start we see the following messages :
> 
> 9:46:03 - [Perfection] Bound to address [/ 0.0.0.0:9300]  
> 9:46:03 - [Perfection] {inet bound\_address [/ 0.0.0.0:9300]}, {inet  
> publish\_address [/ 5.157.247.64:9300]}

It will still be started, and the zen discovery will also be started. If you  
want just to run it on a single node, set node.local to true in the config.

> - Dynamic / Config Mappings : In principle we see no need to disable  
> dynamic mapping, we find it useful, but we also need to define our custom  
> mappings for certain types of data. We believe we have a problem here,  
> because seems that NodeServlet is not detecting our JSON config files :
> 
> We have the following files :
> 
> / WEB-INF/config/default-mapping.json  
> {  
> "_default_" : {  
> "date\_formats" : ["yyyyMMdd", "yyyy-MM-dd", "dd-MM-yyyy",  
> "date\_optional\_time"]  
> }  
> }
> 
> / WEB-INF/config/mappings/myindex/mytype-mapping.json  
> {  
> "mytype" : {  
> "properties" : {  
> "property1" : {  
> "type" : "string"  
> },  
> "property2": {  
> "type" : "boolean"  
> }  
> }  
> }  
> }
> 
> And here is the resulting logging :
> 
> Then we see the logging and ...
> 
> 09:46:07 - [Perfection] [myindex] using dynamic[true], default mapping:  
> location[null] and source[{  
> "_default_" : {  
> }  
> }]  
> 09:46:07 - [Perfection] [myindex] using [resident] field cache with  
> max\_size [-1], expire [null]  
> 09:46:07 - [Perfection] [myindex] Using stats.refresh\_interval [1s]  
> 09:46:07 - [Perfection] [myindex] adding mapping [mytype], source  
> [{"mytype":{"dynamic\_date\_formats":["yyyyMMdd","yyyy-MM-dd","dd-MM-yyyy","date\_optional\_time"],"properties":{"property1":{"type":"string"},"property2":{"type":"string"}]  
> 09:46:07 - [Perfection] [myindex][0] creating shard
> 
> Here I could see two problems :
> 
> 1. The logging about the default mappings says that there is no default  
> config file, but my custom date format appears when the Node is logging the  
> adding of a a mapping for 'mytype'
> 2. The logging make me suppose that the generated mapping related with  
> 'mytype' is provided by the dynamic.mapping feature, correct ? , Because  
> I´ve defined that "property2" field as boolean and seems it´s not detected.

This might be config madness. Here is the logic to resolve the config (which  
I have not checked how ti works within a web container):  
[https://github.com/elasticsearch/elasticsearch/blob/master/modules/elasticsearch/src/main/java/org/elasticsearch/env/Environment.java#L163](https://github.com/elasticsearch/elasticsearch/blob/master/modules/elasticsearch/src/main/java/org/elasticsearch/env/Environment.java#L163).  
It will obviously not find it relative to ES\_HOME, but, it might based on  
the current class loader, not sure... . In theory, a better solution here is  
to use the servlet context (or something similar, been ages since I did  
servlets) to fetch the stream, but its tricky to get it there in a  
non intrusive manner.

> - We are using Eclipse Indigo + Tomcat 6.0 with WTP plugin , perhaps we are  
> inside a "configuration madness" 🙂 ?
> 
> Thanks in advance for all,  
> & Have a nice day
> 
> --  
> Antonio Miguel Fernández Rodríguez  
> Jaraxa Software, SL  
> [www.jaraxa.com](http://www.jaraxa.com)

---

<div class="post-metadata">

**Author:** ![antonio\_fernandez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/antonio_fernandez/32/3083_2.png) [@antonio\_fernandez](https://discuss.elastic.co/u/antonio_fernandez)\
**Post date:** [September 28, 2011, 2:16pm UTC](https://discuss.elastic.co/t/wares-plugin-dynamic-config-mappings-question/5460/3 "2011-09-28T14:16:55Z")

</div>

El 27/09/2011 23:11, Shay Banon escribiÃ³:

> 2011/9/27 Antonio FernÃ¡ndez \<[antonio.fernandez@jaraxa.com](mailto:antonio.fernandez@jaraxa.com)  
> [mailto:antonio.fernandez@jaraxa.com](mailto:antonio.fernandez@jaraxa.com)\>
> 
> ```
> Hi, this is my first post on this mailing list, Greetings from
> MÃ¡laga, Spain :D
> 
> @shay : Congratulations, the ES approach seems very, very interesting.
> 
> A few notes :
> 
> - We find very attractive the ability to define mappings using
> JSON notation, which to my taste is lighter and easier to use XML
> files or Java APIs ( we previously had worked with Lucene API )
> 
> - In a first step of integration of ES we can not use their
> "distributed capabilities", due to restrictions on the intranet
> which hosts our application in production. We therefore we
> consider that the proposed NodeServlet Ware plugin is a perfect
> choise for us.
> 
> - NodeServlet : ItÂ´s clear that deploy it can no longer access the
> server on port 9200, but what happens to port 9300 ? , I ask
> because during the start we see the following messages :
> 
> 9:46:03 - [Perfection] Bound to address [/ 0.0.0.0:9300
> <http://0.0.0.0:9300>]
> 9:46:03 - [Perfection] {inet bound_address [/ 0.0.0.0:9300]},
> {inet publish_address [/ 5.157.247.64:9300
> <http://5.157.247.64:9300>]}
> 
> ```
> 
> It will still be started, and the zen discovery will also be started.  
> If you want just to run it on a single node, set node.local to true in  
> the config.

Perfect & Thanks

> ```
> - Dynamic / Config Mappings : In principle we see no need to
> disable dynamic mapping, we find it useful, but we also need to
> define our custom mappings for certain types of data. We believe
> we have a problem here, because seems that NodeServlet is not
> detecting our JSON config files :
> 
> We have the following files :
> 
> / WEB-INF/config/default-mapping.json
> {
> "_default_" : {
> "date_formats" : ["yyyyMMdd", "yyyy-MM-dd", "dd-MM-yyyy",
> "date_optional_time"]
> }
> }
> 
> / WEB-INF/config/mappings/myindex/mytype-mapping.json
> {
> "mytype" : {
> "properties" : {
> "property1" : {
> "type" : "string"
> },
> "property2": {
> "type" : "boolean"
> }
> }
> }
> }
> 
> And here is the resulting logging :
> 
> Then we see the logging and ...
> 
> 09:46:07 - [Perfection] [myindex] using dynamic[true], default
> mapping: location[null] and source[{
> "_default_" : {
> }
> }]
> 09:46:07 - [Perfection] [myindex] using [resident] field cache
> with max_size [-1], expire [null]
> 09:46:07 - [Perfection] [myindex] Using stats.refresh_interval [1s]
> 09:46:07 - [Perfection] [myindex] adding mapping [mytype], source
> [{"mytype":{"dynamic_date_formats":["yyyyMMdd","yyyy-MM-dd","dd-MM-yyyy","date_optional_time"],"properties":{"property1":{"type":"string"},"property2":{"type":"string"}]
> 09:46:07 - [Perfection] [myindex][0] creating shard
> 
> Here I could see two problems :
> 
> 1) The logging about the default mappings says that there is no
> default config file, but my custom date format appears when the
> Node is logging the adding of a a mapping for 'mytype'
> 2) The logging make me suppose that the generated mapping related
> with 'mytype' is provided by the dynamic.mapping feature, correct
> ? , Because IÂ´ve defined that "property2" field as boolean and
> seems itÂ´s not detected.
> 
> ```
> 
> This might be config madness. Here is the logic to resolve the config  
> (which I have not checked how ti works within a web container):  
> [https://github.com/elasticsearch/elasticsearch/blob/master/modules/elasticsearch/src/main/java/org/elasticsearch/env/Environment.java#L163](https://github.com/elasticsearch/elasticsearch/blob/master/modules/elasticsearch/src/main/java/org/elasticsearch/env/Environment.java#L163).  
> It will obviously not find it relative to ES\_HOME, but, it might based  
> on the current class loader, not sure... . In theory, a better  
> solution here is to use the servlet context (or something similar,  
> been ages since I did servlets) to fetch the stream, but its tricky to  
> get it there in a non intrusive manner.

IÂ´ve included this file into the classpath of my project, and after  
debugging & logging some messages seems itÂ´s only called to resolving  
the correct path for config files 'elasticsearch.yml',  
'elasticsearch.properties', 'names.txt', but there is  
nothing about resolving the correct path of  
"/config/mappings/myindex/mytype.json".

Additionaly I tried putting my custom mapping inside  
default-mapping.json as follow :

Option 1)

{  
"_default_" : {  
"date\_formats" : ["yyyyMMdd", "yyyy-MM-dd", "dd-MM-yyyy",  
"date\_optional\_time"],  
"myindex" : {  
"settings" : {  
"index" : {  
"number\_of\_shards" : 3  
}  
},  
"mappings" : {  
"mytype" : {  
"properties" : {  
"property1" : {  
"type" : "string"  
},  
"property2" : {  
"type" : "boolean"  
}  
}  
}  
}  
}  
}  
}

Option 2)

{  
"_default_" : {  
"date\_formats" : ["yyyyMMdd", "yyyy-MM-dd", "dd-MM-yyyy",  
"date\_optional\_time"],  
},  
"myindex" : {  
"settings" : {  
"index" : {  
"number\_of\_shards" : 3  
}  
},  
"mappings" : {  
"mytype" : {  
"properties" : {  
"property1" : {  
"type" : "string"  
},  
"property2" : {  
"type" : "boolean"  
}  
}  
}  
}  
}

}

... additionaly I disabled the dynamic mapping feature to be completely  
sure that my mappings are detected, but in both cases the results is :

16:12:48 - [Power Man] [grips] using dynamic[false], default mapping:  
location[null] and source[{  
"_default_" : {  
"date\_formats" : ["yyyyMMdd", "yyyy-MM-dd", "dd-MM-yyyy",  
"date\_optional\_time"]  
},  
"myindex" : {  
//.........................................  
}  
}  
]

16:12:48 - [Power Man] [myindex][4] failed to bulk item (index) index  
{[myindex][mytype][91.21X00146A],  
source[{"property1":"91.21X00146A","property2":"true"}]}  
org.elasticsearch.indices.TypeMissingException: [myindex] type[mytype]  
missing: typing to auto create mapping, but dynamic mapping is disabled

Thanks in advance,  
& Have a nice day

> ```
> - We are using Eclipse Indigo + Tomcat 6.0 with WTP plugin ,
> perhaps we are inside a "configuration madness" :) ?
> 
> Thanks in advance for all,
> & Have a nice day
> 
> -- 
> Antonio Miguel FernÃ¡ndez RodrÃ­guez
> Jaraxa Software, SL
> www.jaraxa.com <http://www.jaraxa.com>
> 
> ```

--  
Antonio Miguel FernÃ¡ndez RodrÃ­guez  
Jaraxa Software, SL  
[www.jaraxa.com](http://www.jaraxa.com)

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [October 2, 2011, 8:07am UTC](https://discuss.elastic.co/t/wares-plugin-dynamic-config-mappings-question/5460/4 "2011-10-02T08:07:30Z")

</div>

I am not sure I understand the problem now... . Listing files obviously will  
not work when data is directly used in a war file.

What you can do, is use the API to configure elasticsearch. For example,  
when the node starts up, create an index template, that matches on \*, with a  
_default_ mapping that configures the default configuration that you want  
across all indices, types and mappings.

2011/9/28 Antonio Fernández [antonio.fernandez@jaraxa.com](mailto:antonio.fernandez@jaraxa.com)

> \*\*  
> El 27/09/2011 23:11, Shay Banon escribió:
> 
> 2011/9/27 Antonio Fernández [antonio.fernandez@jaraxa.com](mailto:antonio.fernandez@jaraxa.com)
> 
> > Hi, this is my first post on this mailing list, Greetings from Málaga,  
> > Spain 😃
> > 
> > @shay : Congratulations, the ES approach seems very, very interesting.
> > 
> > A few notes :
> > 
> > - We find very attractive the ability to define mappings using JSON  
> > notation, which to my taste is lighter and easier to use XML files or Java  
> > APIs ( we previously had worked with Lucene API )
> > 
> > - In a first step of integration of ES we can not use their "distributed  
> > capabilities", due to restrictions on the intranet which hosts our  
> > application in production. We therefore we consider that the proposed  
> > NodeServlet Ware plugin is a perfect choise for us.
> > 
> > - NodeServlet : It´s clear that deploy it can no longer access the server  
> > on port 9200, but what happens to port 9300 ? , I ask because during the  
> > start we see the following messages :
> > 
> > 9:46:03 - [Perfection] Bound to address [/ 0.0.0.0:9300]  
> > 9:46:03 - [Perfection] {inet bound\_address [/ 0.0.0.0:9300]}, {inet  
> > publish\_address [/ 5.157.247.64:9300]}
> 
> It will still be started, and the zen discovery will also be started. If  
> you want just to run it on a single node, set node.local to true in the  
> config.
> 
> Perfect & Thanks
> 
> > - Dynamic / Config Mappings : In principle we see no need to disable  
> > dynamic mapping, we find it useful, but we also need to define our custom  
> > mappings for certain types of data. We believe we have a problem here,  
> > because seems that NodeServlet is not detecting our JSON config files :
> > 
> > We have the following files :
> > 
> > / WEB-INF/config/default-mapping.json  
> > {  
> > "_default_" : {  
> > "date\_formats" : ["yyyyMMdd", "yyyy-MM-dd", "dd-MM-yyyy",  
> > "date\_optional\_time"]  
> > }  
> > }
> > 
> > / WEB-INF/config/mappings/myindex/mytype-mapping.json  
> > {  
> > "mytype" : {  
> > "properties" : {  
> > "property1" : {  
> > "type" : "string"  
> > },  
> > "property2": {  
> > "type" : "boolean"  
> > }  
> > }  
> > }  
> > }
> > 
> > And here is the resulting logging :
> > 
> > Then we see the logging and ...
> > 
> > 09:46:07 - [Perfection] [myindex] using dynamic[true], default mapping:  
> > location[null] and source[{  
> > "_default_" : {  
> > }  
> > }]  
> > 09:46:07 - [Perfection] [myindex] using [resident] field cache with  
> > max\_size [-1], expire [null]  
> > 09:46:07 - [Perfection] [myindex] Using stats.refresh\_interval [1s]  
> > 09:46:07 - [Perfection] [myindex] adding mapping [mytype], source  
> > [{"mytype":{"dynamic\_date\_formats":["yyyyMMdd","yyyy-MM-dd","dd-MM-yyyy","date\_optional\_time"],"properties":{"property1":{"type":"string"},"property2":{"type":"string"}]  
> > 09:46:07 - [Perfection] [myindex][0] creating shard
> > 
> > Here I could see two problems :
> > 
> > 1. The logging about the default mappings says that there is no default  
> > config file, but my custom date format appears when the Node is logging the  
> > adding of a a mapping for 'mytype'
> > 2. The logging make me suppose that the generated mapping related with  
> > 'mytype' is provided by the dynamic.mapping feature, correct ? , Because  
> > I´ve defined that "property2" field as boolean and seems it´s not detected.
> 
> This might be config madness. Here is the logic to resolve the config  
> (which I have not checked how ti works within a web container):  
> [https://github.com/elasticsearch/elasticsearch/blob/master/modules/elasticsearch/src/main/java/org/elasticsearch/env/Environment.java#L163](https://github.com/elasticsearch/elasticsearch/blob/master/modules/elasticsearch/src/main/java/org/elasticsearch/env/Environment.java#L163).  
> It will obviously not find it relative to ES\_HOME, but, it might based on  
> the current class loader, not sure... . In theory, a better solution here is  
> to use the servlet context (or something similar, been ages since I did  
> servlets) to fetch the stream, but its tricky to get it there in a  
> non intrusive manner.
> 
> I´ve included this file into the classpath of my project, and after  
> debugging & logging some messages seems it´s only called to resolving the  
> correct path for config files 'elasticsearch.yml',  
> 'elasticsearch.properties', 'names.txt', but there is  
> nothing about resolving the correct path of  
> "/config/mappings/myindex/mytype.json".
> 
> Additionaly I tried putting my custom mapping inside default-mapping.json  
> as follow :
> 
> Option 1)
> 
> {  
> "_default_" : {  
> "date\_formats" : ["yyyyMMdd", "yyyy-MM-dd", "dd-MM-yyyy",  
> "date\_optional\_time"],  
> "myindex" : {  
> "settings" : {  
> "index" : {  
> "number\_of\_shards" : 3  
> }  
> },  
> "mappings" : {
> 
> ```
> "mytype" : {
> "properties" : {
> "property1" : {
> "type" : "string"
> },
> "property2" : {
> "type" : "boolean"
> }
> }
> }
> }
> }
> }
> 
> ```
> 
> }
> 
> Option 2)
> 
> {  
> "_default_" : {  
> "date\_formats" : ["yyyyMMdd", "yyyy-MM-dd", "dd-MM-yyyy",  
> "date\_optional\_time"],  
> },  
> "myindex" : {  
> "settings" : {  
> "index" : {  
> "number\_of\_shards" : 3  
> }  
> },  
> "mappings" : {
> 
> ```
> "mytype" : {
> "properties" : {
> "property1" : {
> "type" : "string"
> },
> "property2" : {
> "type" : "boolean"
> }
> }
> }
> }
> }
> 
> ```
> 
> }
> 
> ... additionaly I disabled the dynamic mapping feature to be completely  
> sure that my mappings are detected, but in both cases the results is :
> 
> 16:12:48 - [Power Man] [grips] using dynamic[false], default mapping:  
> location[null] and source[{  
> "_default_" : {
> 
> ```
> "date_formats" : ["yyyyMMdd", "yyyy-MM-dd", "dd-MM-yyyy",
> 
> ```
> 
> "date\_optional\_time"]  
> },  
> "myindex" : {  
> //.........................................  
> }  
> }  
> ]
> 
> 16:12:48 - [Power Man] [myindex][4] failed to bulk item (index) index  
> {[myindex][mytype][91.21X00146A],  
> source[{"property1":"91.21X00146A","property2":"true"}]}  
> org.elasticsearch.indices.TypeMissingException: [myindex] type[mytype]  
> missing: typing to auto create mapping, but dynamic mapping is disabled
> 
> Thanks in advance,  
> & Have a nice day
> 
> > - We are using Eclipse Indigo + Tomcat 6.0 with WTP plugin , perhaps we  
> > are inside a "configuration madness" 🙂 ?
> > 
> > Thanks in advance for all,  
> > & Have a nice day
> > 
> > --  
> > Antonio Miguel Fernández Rodríguez  
> > Jaraxa Software, SL  
> > [www.jaraxa.com](http://www.jaraxa.com)
> 
> --  
> Antonio Miguel Fernández Rodríguez  
> Jaraxa Software, [SLwww.jaraxa.com](http://SLwww.jaraxa.com)

---

<div class="post-metadata">

**Author:** ![antonio\_fernandez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/antonio_fernandez/32/3083_2.png) [@antonio\_fernandez](https://discuss.elastic.co/u/antonio_fernandez)\
**Post date:** [October 3, 2011, 7:45am UTC](https://discuss.elastic.co/t/wares-plugin-dynamic-config-mappings-question/5460/5 "2011-10-03T07:45:53Z")

</div>

El 02/10/2011 10:07, Shay Banon escribiÃ³:

> I am not sure I understand the problem now... . Listing files  
> obviously will not work when data is directly used in a war file.
> 
> What you can do, is use the API to configure elasticsearch. For  
> example, when the node starts up, create an index template, that  
> matches on \*, with a _default_ mapping that configures the default  
> configuration that you want across all indices, types and mappings.

Hi again, thank you very much for your attention

Sorry for my English, I may have complicated the example.

IÂ´m just trying to define config mapping JSON files as described here :

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

But seems there is a problem using the NodeServlet from Wares Plugin,  
IÂ´ve tried putting my [mapping\_name].json files inside all this paths :

/WEB-INF/config/mappings/\_default/mytype.json  
/WEB-INF/config/mappings/myindex/mytype.json  
/WEB-INF/classes/config/mappings/\_default/mytype.json  
/WEB-INF/classes/config/mappings/myindex/mytype.json

... but the config JSON seems is not detected in any case.

- Could you say me what is the class where is resolved this logic to  
check in both /\_default/ & /myindex/ folders ? Perhaps with an example....

- 
- 

- It is correct the following JSON to define a type ?

\*( mytype.json ) \*

{  
"mytype" : {  
"properties" : {  
"id" : {  
"type" : "string"  
},  
"date" : {  
"type" : "date"  
}  
}  
}  
}

- IÂ´ve tried with the DynamicMapping feature enabled and disabled. In  
the first case all the fields have always "string" as the type , and  
for the second case my documents are not indexed because there is no  
type "mytype" defined.

I hope that my problem is better understood.

Thanks in advance,  
& Nice day for all  
Antonio

> 2011/9/28 Antonio FernÃ¡ndez \<[antonio.fernandez@jaraxa.com](mailto:antonio.fernandez@jaraxa.com)  
> [mailto:antonio.fernandez@jaraxa.com](mailto:antonio.fernandez@jaraxa.com)\>
> 
> ```
> El 27/09/2011 23:11, Shay Banon escribiÃ³:
> 
> ```
> 
> > ```
> > 2011/9/27 Antonio FernÃ¡ndez <antonio.fernandez@jaraxa.com
> > <mailto:antonio.fernandez@jaraxa.com>>
> > 
> > Hi, this is my first post on this mailing list, Greetings
> > from MÃ¡laga, Spain :D
> > 
> > @shay : Congratulations, the ES approach seems very, very
> > interesting.
> > 
> > A few notes :
> > 
> > - We find very attractive the ability to define mappings
> > using JSON notation, which to my taste is lighter and easier
> > to use XML files or Java APIs ( we previously had worked with
> > Lucene API )
> > 
> > - In a first step of integration of ES we can not use their
> > "distributed capabilities", due to restrictions on the
> > intranet which hosts our application in production. We
> > therefore we consider that the proposed NodeServlet Ware
> > plugin is a perfect choise for us.
> > 
> > - NodeServlet : ItÂ´s clear that deploy it can no longer
> > access the server on port 9200, but what happens to port 9300
> > ? , I ask because during the start we see the following
> > messages :
> > 
> > 9:46:03 - [Perfection] Bound to address [/ 0.0.0.0:9300
> > <http://0.0.0.0:9300>]
> > 9:46:03 - [Perfection] {inet bound_address [/ 0.0.0.0:9300]},
> > {inet publish_address [/ 5.157.247.64:9300
> > <http://5.157.247.64:9300>]}
> > 
> > It will still be started, and the zen discovery will also be
> > started. If you want just to run it on a single node, set
> > node.local to true in the config.
> > 
> > ```
> 
> ```
> Perfect & Thanks
> 
> ```
> 
> > ```
> > - Dynamic / Config Mappings : In principle we see no need to
> > disable dynamic mapping, we find it useful, but we also need
> > to define our custom mappings for certain types of data. We
> > believe we have a problem here, because seems that
> > NodeServlet is not detecting our JSON config files :
> > 
> > We have the following files :
> > 
> > / WEB-INF/config/default-mapping.json
> > {
> > "_default_" : {
> > "date_formats" : ["yyyyMMdd", "yyyy-MM-dd",
> > "dd-MM-yyyy", "date_optional_time"]
> > }
> > }
> > 
> > / WEB-INF/config/mappings/myindex/mytype-mapping.json
> > {
> > "mytype" : {
> > "properties" : {
> > "property1" : {
> > "type" : "string"
> > },
> > "property2": {
> > "type" : "boolean"
> > }
> > }
> > }
> > }
> > 
> > And here is the resulting logging :
> > 
> > Then we see the logging and ...
> > 
> > 09:46:07 - [Perfection] [myindex] using dynamic[true],
> > default mapping: location[null] and source[{
> > "_default_" : {
> > }
> > }]
> > 09:46:07 - [Perfection] [myindex] using [resident] field
> > cache with max_size [-1], expire [null]
> > 09:46:07 - [Perfection] [myindex] Using
> > stats.refresh_interval [1s]
> > 09:46:07 - [Perfection] [myindex] adding mapping [mytype],
> > source
> > [{"mytype":{"dynamic_date_formats":["yyyyMMdd","yyyy-MM-dd","dd-MM-yyyy","date_optional_time"],"properties":{"property1":{"type":"string"},"property2":{"type":"string"}]
> > 09:46:07 - [Perfection] [myindex][0] creating shard
> > 
> > Here I could see two problems :
> > 
> > 1) The logging about the default mappings says that there is
> > no default config file, but my custom date format appears
> > when the Node is logging the adding of a a mapping for 'mytype'
> > 2) The logging make me suppose that the generated mapping
> > related with 'mytype' is provided by the dynamic.mapping
> > feature, correct ? , Because IÂ´ve defined that "property2"
> > field as boolean and seems itÂ´s not detected.
> > 
> > This might be config madness. Here is the logic to resolve the
> > config (which I have not checked how ti works within a web
> > container):
> > https://github.com/elasticsearch/elasticsearch/blob/master/modules/elasticsearch/src/main/java/org/elasticsearch/env/Environment.java#L163.
> > It will obviously not find it relative to ES_HOME, but, it might
> > based on the current class loader, not sure... . In theory, a
> > better solution here is to use the servlet context (or something
> > similar, been ages since I did servlets) to fetch the stream, but
> > its tricky to get it there in a non intrusive manner.
> > 
> > ```
> 
> ```
> IÂ´ve included this file into the classpath of my project, and
> after debugging & logging some messages seems itÂ´s only called to
> resolving the correct path for config files 'elasticsearch.yml',
> 'elasticsearch.properties', 'names.txt', but there is
> nothing about resolving the correct path of
> "/config/mappings/myindex/mytype.json".
> 
> Additionaly I tried putting my custom mapping inside
> default-mapping.json as follow :
> 
> Option 1)
> 
> {
> "_default_" : {
> "date_formats" : ["yyyyMMdd", "yyyy-MM-dd", "dd-MM-yyyy",
> "date_optional_time"],
> "myindex" : {
> "settings" : {
> "index" : {
> "number_of_shards" : 3
> }
> },
> "mappings" : {
> 
> "mytype" : {
> "properties" : {
> "property1" : {
> "type" : "string"
> },
> "property2" : {
> "type" : "boolean"
> }
> }
> }
> }
> }
> }
> }
> 
> Option 2)
> 
> {
> "_default_" : {
> "date_formats" : ["yyyyMMdd", "yyyy-MM-dd", "dd-MM-yyyy",
> "date_optional_time"],
> },
> "myindex" : {
> "settings" : {
> "index" : {
> "number_of_shards" : 3
> }
> },
> "mappings" : {
> 
> "mytype" : {
> "properties" : {
> "property1" : {
> "type" : "string"
> },
> "property2" : {
> "type" : "boolean"
> }
> }
> }
> }
> }
> 
> }
> 
> ... additionaly I disabled the dynamic mapping feature to be
> completely sure that my mappings are detected, but in both cases
> the results is :
> 
> 16:12:48 - [Power Man] [grips] using dynamic[false], default
> mapping: location[null] and source[{
> "_default_" : {
> 
> "date_formats" : ["yyyyMMdd", "yyyy-MM-dd", "dd-MM-yyyy",
> "date_optional_time"]
> },
> "myindex" : {
> //.........................................
> }
> }
> ]
> 
> 16:12:48 - [Power Man] [myindex][4] failed to bulk item (index)
> index {[myindex][mytype][91.21X00146A],
> source[{"property1":"91.21X00146A","property2":"true"}]}
> org.elasticsearch.indices.TypeMissingException: [myindex]
> type[mytype] missing: typing to auto create mapping, but dynamic
> mapping is disabled
> 
> Thanks in advance,
> & Have a nice day
> 
> ```
> 
> > ```
> > - We are using Eclipse Indigo + Tomcat 6.0 with WTP plugin ,
> > perhaps we are inside a "configuration madness" :) ?
> > 
> > Thanks in advance for all,
> > & Have a nice day
> > 
> > -- 
> > Antonio Miguel FernÃ¡ndez RodrÃ­guez
> > Jaraxa Software, SL
> > www.jaraxa.com <http://www.jaraxa.com>
> > 
> > ```
> 
> ```
> -- 
> Antonio Miguel FernÃ¡ndez RodrÃ­guez
> Jaraxa Software, SL
> www.jaraxa.com <http://www.jaraxa.com>
> 
> ```

--  
Antonio Miguel FernÃ¡ndez RodrÃ­guez  
Jaraxa Software, SL  
[www.jaraxa.com](http://www.jaraxa.com)

---

<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 6, 2017, 3:53am UTC](https://discuss.elastic.co/t/wares-plugin-dynamic-config-mappings-question/5460/6 "2017-07-06T03:53:03Z")

</div>


