# Search via Query String DSL

**URL:** <https://discuss.elastic.co/t/search-via-query-string-dsl/62293>\
**Category:** Elasticsearch\
**Created:** [October 5, 2016, 4:13pm UTC](https://discuss.elastic.co/t/search-via-query-string-dsl/62293 "2016-10-05T16:13:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![minhnhat2807](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/minhnhat2807/32/12311_2.png) [@minhnhat2807](https://discuss.elastic.co/u/minhnhat2807)\
**Post date:** [October 5, 2016, 4:13pm UTC](https://discuss.elastic.co/t/search-via-query-string-dsl/62293/1 "2016-10-05T16:13:14Z")

</div>

Hi all, I'm using the query like that

GET \_search  
{  
"query": {  
"query\_string": {  
"query": "curator"  
}  
}  
}  
==\> returned 3 items

GET \_search  
{  
"query": {  
"query\_string": {  
"query": "curato"  
}  
}  
}  
==\> returned 0 item

GET \_search  
{  
"query": {  
"query\_string": {  
"query": "curat"  
}  
}  
}  
==\> returned 3 items

I don't know what are differences between 3 keywords "curator", "curato" and "curat" ==\> should return 3 items as expected. Any suggestions or explanations for these cases?

Thanks

---

<div class="post-metadata">

**Author:** ![javanna](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javanna/32/4698_2.png) [@javanna](https://discuss.elastic.co/u/javanna)\
**Post date:** [October 5, 2016, 5:57pm UTC](https://discuss.elastic.co/t/search-via-query-string-dsl/62293/2 "2016-10-05T17:57:02Z")

</div>

With your query you are looking for the exact terms "curator", "curato" or "curat". Whether you have those terms in your index or not depends on your data and how you indexed it (analysis chain).

Are you rather looking for anything that starts with "curat" ?

---

<div class="post-metadata">

**Author:** ![minhnhat2807](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/minhnhat2807/32/12311_2.png) [@minhnhat2807](https://discuss.elastic.co/u/minhnhat2807)\
**Post date:** [October 6, 2016, 2:58am UTC](https://discuss.elastic.co/t/search-via-query-string-dsl/62293/3 "2016-10-06T02:58:21Z")

</div>

I limited the query with only field  
"fields": [  
"PostText"  
],

and data source only have 3 documents  
"PostText": "curator post",  
"PostText": "abc 4 curator post",  
"PostText": "curator post 2",

even I used wildcard for search string but the result is not good  
GET \_search  
{  
"query": {  
"query\_string": {  
"fields": [  
"PostText"  
],  
"query": "STARcuratoSTAR", ==\> STAR: \*  
"analyze\_wildcard": true  
}  
}  
}  
==\> returned 0 item

I set analyzer like that:  
var indexSettings={  
"settings": {  
"analysis": {   
"analyzer": {  
"default": {  
"type": "smartcn"  
}  
}  
}  
}  
};

is it ok?

---

<div class="post-metadata">

**Author:** ![javanna](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javanna/32/4698_2.png) [@javanna](https://discuss.elastic.co/u/javanna)\
**Post date:** [October 6, 2016, 6:28am UTC](https://discuss.elastic.co/t/search-via-query-string-dsl/62293/4 "2016-10-06T06:28:16Z")

</div>

Ok, I think that means you want to do partial search, and using wildcards is one away, but there are others way too. First of all though, could you explain what your usecase is, just to verify that you indeed need partial search?

Thanks

---

<div class="post-metadata">

**Author:** ![minhnhat2807](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/minhnhat2807/32/12311_2.png) [@minhnhat2807](https://discuss.elastic.co/u/minhnhat2807)\
**Post date:** [October 6, 2016, 6:35am UTC](https://discuss.elastic.co/t/search-via-query-string-dsl/62293/5 "2016-10-06T06:35:46Z")

</div>

@javanna thanks for your quick reply, after had a look more carefully I think the problem come from smartcn analyzer, more details

> [@Trouble SmartCN analyzer](https://discuss.elastic.co/t/trouble-smartcn-analyzer/62328):
>
> Hi all, curl -XGET '[http://localhost:9200/mm-chs/\_analyze?analyzer=smartcn](http://localhost:9200/mm-chs/_analyze?analyzer=smartcn)' -d 'curator post' {"tokens":[{"token":"curat","start\_offset":0,"end\_offset":7,"type":"word","position":0},{"token":"post","start\_offset":8,"end\_offset":12,"type":"word","position":1}]} Anyone can explain why it curat and post? maybe it's end with OR so ... condition Thanks.

---

<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:14pm UTC](https://discuss.elastic.co/t/search-via-query-string-dsl/62293/6 "2017-07-05T22:14:28Z")

</div>


