# Add settings and mapping when create new \_river mongodb

**URL:** https://discuss.elastic.co/t/add-settings-and-mapping-when-create-new--river-mongodb/13059
**Category:** Elasticsearch
**Created:** [August 4, 2013, 8:58am UTC](https://discuss.elastic.co/t/add-settings-and-mapping-when-create-new--river-mongodb/13059 "2013-08-04T08:58:46Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![manhnv](https://avatars.discourse-cdn.com/v4/letter/m/ecccb3/32.png) [@manhnv](https://discuss.elastic.co/u/manhnv)
#### Post date: [August 4, 2013, 8:58am UTC](https://discuss.elastic.co/t/add-settings-and-mapping-when-create-new--river-mongodb/13059/1 "2013-08-04T08:58:46Z")

</div>

Hi everybody!

I want to add settings and mappings when I create new \_river mongodb  
following that:

curl -XPUT 'localhost:9200/\_river/mongodb/\_meta' -d '{  
"type": "mongodb",  
"mongodb": {  
"servers": [  
{"host": "Konoha", "port": 27018},  
{"host": "Konoha", "port": 27027}  
],  
"db": "testmongo",  
"collection": "person",  
"options": {  
"secondary\_read\_preference": true,  
"drop\_collection": true  
},  
"gridfs": false  
},  
"index": {  
"name": "person",  
"type": "person"  
},  
"settings": {  
"analysis": {  
"analyzer": {  
"index\_analyzer": {  
"tokenizer": "standard",  
"filter": ["standard", "my\_delimiter", "lowercase",  
"stop", "asciifolding", "porter\_stem"]  
},  
"search\_analyzer": {  
"tokenizer": "standard",  
"filter": ["standard", "lowercase", "stop",  
"asciifolding", "porter\_stem"]  
}  
},  
"filter": {  
"my\_delimiter": {  
"type": "word\_delimiter",  
"generate\_word\_parts": true,  
"catenate\_words": true,  
"catenate\_numbers": true,  
"catenate\_all": true,  
"split\_on\_case\_change": true,  
"preserve\_original": true,  
"split\_on\_numerics": true,  
"stem\_english\_possessive": true  
}  
}  
}  
}  
}'

When I run: [http://localhost:9200/person/\_settings](http://localhost:9200/person/_settings) on my browser, results  
are:

{"person":{"settings":{"index.number\_of\_shards":"5","index.number\_of\_replicas":"1","index.version.created":"900299"}}}

It seem my settings above was not applied ☹

Can you help me the way to add settings or mapping when initiate mongodb river

Thank you for helping me 🙂

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [August 4, 2013, 11:32am UTC](https://discuss.elastic.co/t/add-settings-and-mapping-when-create-new--river-mongodb/13059/2 "2013-08-04T11:32:36Z")

</div>

Create index person with it's settings and mapping for peron type before creating the river.

See:  
[http://www.elasticsearch.org/guide/reference/api/admin-indices-create-index/](http://www.elasticsearch.org/guide/reference/api/admin-indices-create-index/)  
[http://www.elasticsearch.org/guide/reference/api/admin-indices-put-mapping/](http://www.elasticsearch.org/guide/reference/api/admin-indices-put-mapping/)

--  
David 😉  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 4 août 2013 à 10:58, manhnv@gsm.vn a écrit :

Hi everybody!

I want to add settings and mappings when I create new \_river mongodb following that:

curl -XPUT 'localhost:9200/\_river/mongodb/\_meta' -d '{  
"type": "mongodb",  
"mongodb": {  
"servers": [  
{"host": "Konoha", "port": 27018},  
{"host": "Konoha", "port": 27027}  
],  
"db": "testmongo",  
"collection": "person",  
"options": {  
"secondary\_read\_preference": true,  
"drop\_collection": true  
},  
"gridfs": false  
},  
"index": {  
"name": "person",  
"type": "person"  
},  
"settings": {  
"analysis": {  
"analyzer": {  
"index\_analyzer": {  
"tokenizer": "standard",  
"filter": ["standard", "my\_delimiter", "lowercase", "stop", "asciifolding", "porter\_stem"]  
},  
"search\_analyzer": {  
"tokenizer": "standard",  
"filter": ["standard", "lowercase", "stop", "asciifolding", "porter\_stem"]  
}  
},  
"filter": {  
"my\_delimiter": {  
"type": "word\_delimiter",  
"generate\_word\_parts": true,  
"catenate\_words": true,  
"catenate\_numbers": true,  
"catenate\_all": true,  
"split\_on\_case\_change": true,  
"preserve\_original": true,  
"split\_on\_numerics": true,  
"stem\_english\_possessive": true  
}  
}  
}  
}  
}'

When I run: [http://localhost:9200/person/\_settings](http://localhost:9200/person/_settings) on my browser, results are:  
{"person":{"settings":{"index.number\_of\_shards":"5","index.number\_of\_replicas":"1","index.version.created":"900299"}}}

It seem my settings above was not applied ☹

Can you help me the way to add settings or mapping when initiate mongodb river

Thank you for helping me 🙂

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![manhnv](https://avatars.discourse-cdn.com/v4/letter/m/ecccb3/32.png) [@manhnv](https://discuss.elastic.co/u/manhnv)
#### Post date: [August 5, 2013, 3:29pm UTC](https://discuss.elastic.co/t/add-settings-and-mapping-when-create-new--river-mongodb/13059/3 "2013-08-05T15:29:37Z")

</div>

Thank you very much, David Pilato 😃

I did it 😛

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![manhnv](https://avatars.discourse-cdn.com/v4/letter/m/ecccb3/32.png) [@manhnv](https://discuss.elastic.co/u/manhnv)
#### Post date: [August 6, 2013, 7:46am UTC](https://discuss.elastic.co/t/add-settings-and-mapping-when-create-new--river-mongodb/13059/4 "2013-08-06T07:46:58Z")

</div>

Hi, I have a record following:

"sony vaio is best laptop"

When I search: "so" or "be" or "lap". It returns result

But when I search "top" or "aio" or "ony". It does not return any result

I think the ES will search from beginning of the word

Can you tell me, how can I search anywhere of the word (make filter?)

Thank you very much

On Monday, August 5, 2013 10:29:37 PM UTC+7, man...@gsm.vn wrote:

> Thank you very much, David Pilato 😃
> 
> I did it 😛

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [August 7, 2013, 6:39am UTC](https://discuss.elastic.co/t/add-settings-and-mapping-when-create-new--river-mongodb/13059/5 "2013-08-07T06:39:54Z")

</div>

Hey,

check out the ngram tokenizer, it does what you need. However be aware,  
that this results in a bigger index and may result in a result explosion...

--Alex

On Tue, Aug 6, 2013 at 9:46 AM, [manhnv@gsm.vn](mailto:manhnv@gsm.vn) wrote:

> Hi, I have a record following:
> 
> "sony vaio is best laptop"
> 
> When I search: "so" or "be" or "lap". It returns result
> 
> But when I search "top" or "aio" or "ony". It does not return any result
> 
> I think the ES will search from beginning of the word
> 
> Can you tell me, how can I search anywhere of the word (make filter?)
> 
> Thank you very much
> 
> On Monday, August 5, 2013 10:29:37 PM UTC+7, man...@gsm.vn wrote:
> 
> > Thank you very much, David Pilato 😃
> > 
> > I did it 😛
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![manhnv](https://avatars.discourse-cdn.com/v4/letter/m/ecccb3/32.png) [@manhnv](https://discuss.elastic.co/u/manhnv)
#### Post date: [August 7, 2013, 6:45am UTC](https://discuss.elastic.co/t/add-settings-and-mapping-when-create-new--river-mongodb/13059/6 "2013-08-07T06:45:55Z")

</div>

Hi, thanks for your reply. I know using NGram tokenizer will get the  
results 😃

On Wednesday, August 7, 2013 1:39:54 PM UTC+7, Alexander Reelsen wrote:

> Hey,
> 
> check out the ngram tokenizer, it does what you need. However be aware,  
> that this results in a bigger index and may result in a result explosion...
> 
> --Alex
> 
> On Tue, Aug 6, 2013 at 9:46 AM, \<man...@gsm.vn \<javascript:\>\> wrote:
> 
> > Hi, I have a record following:
> > 
> > "sony vaio is best laptop"
> > 
> > When I search: "so" or "be" or "lap". It returns result
> > 
> > But when I search "top" or "aio" or "ony". It does not return any result
> > 
> > I think the ES will search from beginning of the word
> > 
> > Can you tell me, how can I search anywhere of the word (make filter?)
> > 
> > Thank you very much
> > 
> > On Monday, August 5, 2013 10:29:37 PM UTC+7, man...@gsm.vn wrote:
> > 
> > > Thank you very much, David Pilato 😃
> > > 
> > > I did it 😛
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:22am UTC](https://discuss.elastic.co/t/add-settings-and-mapping-when-create-new--river-mongodb/13059/7 "2017-07-06T02:22:31Z")

</div>


