# Query\_string not returning results that is known to be in the searched fields

**URL:** <https://discuss.elastic.co/t/query-string-not-returning-results-that-is-known-to-be-in-the-searched-fields/217604>\
**Category:** Elasticsearch\
**Created:** [February 3, 2020, 10:20am UTC](https://discuss.elastic.co/t/query-string-not-returning-results-that-is-known-to-be-in-the-searched-fields/217604 "2020-02-03T10:20:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ErikWarming](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/erikwarming/32/39525_2.png) [@ErikWarming](https://discuss.elastic.co/u/ErikWarming)\
**Post date:** [February 3, 2020, 10:20am UTC](https://discuss.elastic.co/t/query-string-not-returning-results-that-is-known-to-be-in-the-searched-fields/217604/1 "2020-02-03T10:20:43Z")

</div>

I have an index with data in several nested fields, that I want to build a small search engine for. Below I have my query, data example, and mapping.

I'm using _highlight_ to display my result

If I search for "known existing phrase" I will get a search result that contains some of the words. The _default\_operator_ is _OR_, so that makes sense.

If I search for ""known existing phrase"", I would expect I would get this exact _known existing phrase_ that I know is in my data, I get no hits.  
If I set the _default\_operator_ to _AND_ I also get no results

I can't figure out if it is

1. my query that is wrong
2. if it is _highlight_ causing problems
3. if it is searching in different nested fields that is the issue
4. if I need an extra function like _inner\_hits_

Any advice would be helpful

My query (from kibana)

> ```
> GET graph_dummy_data/_search
> {
> "query": {
> "query_string": {
> "query": "known existing phrase",
> "fields": [ "graph_title", "graph_description"
> , "simulationer.title" , "simulationer.description"
> , "simulationer.trace.description", "simulationer.trace.label"
> , "simulationer.trace.guide", "simulationer.trace.purpose"],
> }
> },
> "highlight": {
> "fields": {
> "graph_title": {"pre_tags": ["<mark>"], "post_tags": ["</mark>"]},
> "graph_description": {"pre_tags": ["<mark>"], "post_tags": ["</mark>"]},
> "simulationer.title": {"pre_tags": ["<mark>"], "post_tags": ["</mark>"]},
> "simulationer.description": {"pre_tags": ["<mark>"], "post_tags": ["</mark>"]},
> "simulationer.trace.description": {"pre_tags": ["<mark>"], "post_tags": ["</mark>"]},
> "simulationer.trace.label": {"pre_tags": ["<mark>"], "post_tags": ["</mark>"]},
> "simulationer.trace.guide": {"pre_tags": ["<mark>"], "post_tags": ["</mark>"]},
> "simulationer.trace.purpose": {"pre_tags": ["<mark>"], "post_tags": ["</mark>"]}
> }
> }
> }
> 
> ```

My data

> ```
> "_index" : "Graph dummy data",
> "_type" : "_doc",
> "_id" : "14660",
> "_score" : 1.0,
> "_source" : {
> "graph_description" : "Graph description, encoded as tekst and should be searchable",
> "response" : "OK",
> "graph_id" : "14660",
> "@timestamp" : "2020-01-31T10:04:05.034Z",
> "graph_majortimestamp" : "2020-01-17T08:59:12.0000000Z",
> "graph_title" : "Graph title, encoded as tekst and should be searchable",
> "@version" : "1",
> "simulationer" : [
> {
> "created" : "2020-01-13T11:16:18.8930000Z",
> "title" : "Simulationer title, encoded as tekst and should be searchable",
> "id" : "195213",
> "trace" : [
> {
> "guide" : "",
> "role" : "Role 1, not searchable",
> "purpose" : "Activity purpose, encoded as tekst and should be searchable",
> "id" : "Activity3_1",
> "label" : "Activity label, encoded as tekst and should be searchable",
> "description" : "Activity description, encoded as tekst and should be searchable"
> },
> {
> "guide" : "",
> "role" : "Role 1, not searchable",
> "purpose" : "Activity purpose, encoded as tekst and should be searchable",
> "id" : "Activity5",
> "label" : "Activity label, encoded as tekst and should be searchable",
> "description" : "Activity description, encoded as tekst and should be searchable"
> },
> {
> "guide" : "",
> "role" : "Role 1, not searchable",
> "purpose" : "Activity purpose, encoded as tekst and should be searchable",
> "id" : "Activity22_1",
> "label" : "Activity label, encoded as tekst and should be searchable",
> "description" : "Activity description, encoded as tekst and should be searchable"
> },
> {
> "guide" : "",
> "role" : "Role 1, not searchable",
> "purpose" : "Activity purpose, encoded as tekst and should be searchable",
> "id" : "Activity33",
> "label" : "Activity label, encoded as tekst and should be searchable",
> "description" : "Activity description, encoded as tekst and should be searchable"
> }
> ],
> "description" : Simulation description, encoded as tekst and should be searchable"
> },
> 
> ```

My data's mapping

```
"mappings" : {
  "properties" : {
    "@timestamp" : {
      "type" : "date"
    },
    "@version" : {
      "type" : "text",
      "fields" : {
        "keyword" : {
          "type" : "keyword",
          "ignore_above" : 256
        }
      }
    },
    "graph_category" : {
      "type" : "text"
    },
    "graph_description" : {
      "type" : "text",
      "analyzer" : "danish"
    },
    "graph_id" : {
      "type" : "integer"
    },
    "graph_majortimestamp" : {
      "type" : "date"
    },
    "graph_title" : {
      "type" : "text",
      "analyzer" : "danish"
    },
    "response" : {
      "type" : "text",
      "fields" : {
        "keyword" : {
          "type" : "keyword",
          "ignore_above" : 256
        }
      }
    },
    "simulationer" : {
      "type" : "nested",
      "properties" : {
        "created" : {
          "type" : "date"
        },
        "description" : {
          "type" : "text",
          "analyzer" : "danish"
        },
        "id" : {
          "type" : "integer"
        },
        "simulation_roles" : {
          "type" : "text"
        },
        "title" : {
          "type" : "text",
          "analyzer" : "danish"
        },
        "trace" : {
          "type" : "nested",
          "properties" : {
            "description" : {
              "type" : "text",
              "analyzer" : "danish"
            },
            "guide" : {
              "type" : "text",
              "analyzer" : "danish"
            },
            "id" : {
              "type" : "text"
            },
            "label" : {
              "type" : "text",
              "analyzer" : "danish"
            },
            "purpose" : {
              "type" : "text",
              "analyzer" : "danish"
            },
            "role" : {
              "type" : "text"
            }
          }
        }
      }
    },
    "type" : {
      "type" : "text",
      "fields" : {
        "keyword" : {
          "type" : "keyword",
          "ignore_above" : 256
        }
      }
    }
  }
}
  }
}

```

---

<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:** [March 2, 2020, 10:20am UTC](https://discuss.elastic.co/t/query-string-not-returning-results-that-is-known-to-be-in-the-searched-fields/217604/2 "2020-03-02T10:20:48Z")

</div>

Closed on March 2, 2020, 10:20am UTC

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