# Problem with query\_string and default\_operator query

**URL:** <https://discuss.elastic.co/t/problem-with-query-string-and-default-operator-query/14181>\
**Category:** Elasticsearch\
**Created:** [October 31, 2013, 1:53am UTC](https://discuss.elastic.co/t/problem-with-query-string-and-default-operator-query/14181 "2013-10-31T01:53:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kristof\_Kowalski](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kristof_kowalski/32/2012_2.png) [@Kristof\_Kowalski](https://discuss.elastic.co/u/Kristof_Kowalski)\
**Post date:** [October 31, 2013, 1:53am UTC](https://discuss.elastic.co/t/problem-with-query-string-and-default-operator-query/14181/1 "2013-10-31T01:53:06Z")

</div>

Hi all,

I seem to be getting some strange results when using the "default\_operator"  
: "AND" property in the query\_string query. It seems to reverting back to  
the defaults and using the OR value. Any ideas?

Here is a sample query of the index;

{  
"fields": [ "attachment.title", "filename", "url\_dl", "year",  
"attachment.content\_length", "attachment.content\_type" ],  
"query":{  
"query\_string":{  
"default\_operator" : "AND",  
"analyze\_wildcard": true,  
"query":"Skinner William"  
}  
},  
"highlight": {  
"pre\_tags" : [""],  
"post\_tags" : [""],  
"fields": {  
"attachment.keywords": {"fragment\_size" : 150, "number\_of\_fragments"  
: 3},  
"attachment": {"fragment\_size" : 150, "number\_of\_fragments" : 3}  
}  
},  
"size": 1,  
"from": 0  
}

The results it shows is Skinner OR William and not the whole Skinner AND  
William phrase.;

"highlight": {  
"attachment": [  
"Fotheringltam st, Mer'ville \nSkues Willie in, 1  
Hobbs St. Lewisham \nSknes \William, 72 Morgan st,  
IMarriekville \nSI:Wander Jens 138 'Trafalgar et, A'dale ",  
"slack W., builder, %Variable \nSlack W. F., May's  
11111, Parramatta \nSick William H., 15 Regent st, Newtown  
\nSlacksmith A. 1.1., grazier, Tamba Springs \nSlack-smith",  
"grazier, Herren \n\n'function \nSlacksmith James,  
farmer, Buglibone \n\nSkinner William,  
dentist. 179 Oxford St Slack-Smith J. L., grazier, Coonamble \nnod 39"  
]  
}

We can use the match\_phrase query and all is well but we need the wildcard  
option to work for us, hence why we are using query\_string query.

Any helps would be awesome.

Cheers,

Kristof

--  
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/problem-with-query-string-and-default-operator-query/14181/2 "2017-07-06T02:09:41Z")

</div>


