# Elasticsearch and mongodb, partial search not working

**URL:** <https://discuss.elastic.co/t/elasticsearch-and-mongodb-partial-search-not-working/14172>\
**Category:** Elasticsearch\
**Created:** [October 30, 2013, 11:41am UTC](https://discuss.elastic.co/t/elasticsearch-and-mongodb-partial-search-not-working/14172 "2013-10-30T11:41:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rakesh\_goyal](https://avatars.discourse-cdn.com/v4/letter/r/3da27b/32.png) [@rakesh\_goyal](https://discuss.elastic.co/u/rakesh_goyal)\
**Post date:** [October 30, 2013, 11:41am UTC](https://discuss.elastic.co/t/elasticsearch-and-mongodb-partial-search-not-working/14172/1 "2013-10-30T11:41:58Z")

</div>

This is my location Collection in mongodb:

{ "\_id" : ObjectId("5270d36f28f31fd8fa016441"), "stateName" : "A5", "cityName" : "ABCNEW2" }{ "\_id" : ObjectId("5270d37328f31fd8fa016442"), "stateName" : "A5", "cityName" : "ABC" }{ "\_id" : ObjectId("5270d37b28f31fd8fa016443"), "stateName" : "65", "cityName" : "ABCRW" }

I created one index using elastic Search:

POST /bwitter{"index":  
{ "number\_of\_shards": 1,  
"analysis": {  
"filter": {  
"mynGram" : {"type": "nGram", "min\_gram": 2, "max\_gram": 10}  
},  
"analyzer": { "a1" : {  
"type":"custom",  
"tokenizer": "standard",  
"filter": ["lowercase", "mynGram"]  
}  
}  
}  
}}

I created one mapping using elastic search:

PUT /bwitter/bweet/\_mapping{  
"bweet" : {  
"index\_analyzer" : "a1",  
"search\_analyzer" : "standard",  
"properties" : {  
"stateName": {"type":"string", "analyzer":"standard"},  
"cityName" : {"type" : "string" }  
}  
}

}

Created river as follows:

PUT /\_river/mongodb/\_meta{  
"type": "mongodb",  
"mongodb": {  
"db": "rakeshdb",  
"collection": "locations"  
},  
"index": {  
"name": "locations",  
"type": "bweet"  
}}

If, I query GET /locations/\_search?q=ABC, I get only one record (Full word  
search is happening, not happening for the partial word)

I almost spend a whole day on this but not able to solve this. Where am I  
going wrong?

--  
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:** [October 30, 2013, 12:13pm UTC](https://discuss.elastic.co/t/elasticsearch-and-mongodb-partial-search-not-working/14172/2 "2013-10-30T12:13:20Z")

</div>

I guess that it should be:  
PUT /\_river/mongodb/\_meta  
{  
"type": "mongodb",  
"mongodb": {  
"db": "rakeshdb",  
"collection": "locations"  
},  
"index": {  
"name": "bwitter",  
"type": "bweet"  
}  
}

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

Le 30 oct. 2013 à 12:41, rakesh goyal [goyal.nitj@gmail.com](mailto:goyal.nitj@gmail.com) a écrit :

This is my location Collection in mongodb:

{ "\_id" : ObjectId("5270d36f28f31fd8fa016441"), "stateName" : "A5", "cityName" : "ABCNEW2" }  
{ "\_id" : ObjectId("5270d37328f31fd8fa016442"), "stateName" : "A5", "cityName" : "ABC" }  
{ "\_id" : ObjectId("5270d37b28f31fd8fa016443"), "stateName" : "65", "cityName" : "ABCRW" }  
I created one index using elastic Search:

POST /bwitter  
{"index":  
{ "number\_of\_shards": 1,  
"analysis": {  
"filter": {  
"mynGram" : {"type": "nGram", "min\_gram": 2, "max\_gram": 10}  
},  
"analyzer": { "a1" : {  
"type":"custom",  
"tokenizer": "standard",  
"filter": ["lowercase", "mynGram"]  
}  
}  
}  
}  
}  
I created one mapping using elastic search:

PUT /bwitter/bweet/\_mapping  
{  
"bweet" : {  
"index\_analyzer" : "a1",  
"search\_analyzer" : "standard",  
"properties" : {  
"stateName": {"type":"string", "analyzer":"standard"},  
"cityName" : {"type" : "string" }  
}  
}  
}

Created river as follows:

PUT /\_river/mongodb/\_meta  
{  
"type": "mongodb",  
"mongodb": {  
"db": "rakeshdb",  
"collection": "locations"  
},  
"index": {  
"name": "locations",  
"type": "bweet"  
}  
}  
If, I query GET /locations/\_search?q=ABC, I get only one record (Full word search is happening, not happening for the partial word)

I almost spend a whole day on this but not able to solve this. Where am I going wrong?

--  
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:** ![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:09am UTC](https://discuss.elastic.co/t/elasticsearch-and-mongodb-partial-search-not-working/14172/3 "2017-07-06T02:09:49Z")

</div>


