# Google-like search behaviors : wildcards, exact match

**URL:** <https://discuss.elastic.co/t/google-like-search-behaviors-wildcards-exact-match/182397>\
**Category:** Elasticsearch\
**Created:** [May 23, 2019, 10:10am UTC](https://discuss.elastic.co/t/google-like-search-behaviors-wildcards-exact-match/182397 "2019-05-23T10:10:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Keb](https://avatars.discourse-cdn.com/v4/letter/k/c67d28/32.png) [@Keb](https://discuss.elastic.co/u/Keb)\
**Post date:** [May 23, 2019, 10:10am UTC](https://discuss.elastic.co/t/google-like-search-behaviors-wildcards-exact-match/182397/1 "2019-05-23T10:10:39Z")

</div>

Hello,  
I'm trying to add some well-known behaviors on my search engine, so users can use what they already know with Google search engine : double quotes for exact matchs, wildcards...

From what I've seen, a query\_string request seems ideal because it is already parsing the string to find all those things, which is great news, but the exact match behavior is different from Google and I don't really understand why.

I'm playing around with Kibana so far, but I'm using the php driver and ES 6.5. Here's a request example :

> ```
> {
> "size": 20,
> "query": {
> "bool": {
> "should": [
> {
> "query_string": {
> "query": "Foo \"exact match string\" Bar",
> "fields" : [
> "field1",
> "field2^2"
> ]
> }
> }
> ]
> }
> }
> }
> 
> ```

The issue here is with the words Foo and Bar, because the results still give me documents without my "exact match string". From what I've observed, it is because they contain either Foo or Bar, which is not how Google work. "exact match string" should always be in the searched fields, whether Foo or Bar is found.  
If my query is only "exact match string", it seems to work well and only gives me results containing the string.

Keep in mind this is only a sample request, my final request also includes searching in nested fields, and has aggregations, if that matters at all. This is why there's a "should" instruction, I need to search in nested1, nested2, and a query\_string in some fields, but I don't think it's a problem to achieve what I want.

Am I missing something here ?

---

<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:** [May 23, 2019, 12:52pm UTC](https://discuss.elastic.co/t/google-like-search-behaviors-wildcards-exact-match/182397/2 "2019-05-23T12:52:43Z")

</div>

You might try something:

```auto
"Foo +\"exact match string\" Bar"

```

Or change `default_operator` which is `OR` by default to `AND`.

My 2 cents

---

<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:** [June 20, 2019, 12:52pm UTC](https://discuss.elastic.co/t/google-like-search-behaviors-wildcards-exact-match/182397/3 "2019-06-20T12:52:46Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
