# Search query not fethcing all the results

**URL:** <https://discuss.elastic.co/t/search-query-not-fethcing-all-the-results/355790>\
**Category:** Elasticsearch\
**Created:** [March 20, 2024, 7:48am UTC](https://discuss.elastic.co/t/search-query-not-fethcing-all-the-results/355790 "2024-03-20T07:48:28Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mohan\_T](https://avatars.discourse-cdn.com/v4/letter/m/34f0e0/32.png) [@Mohan\_T](https://discuss.elastic.co/u/Mohan_T)\
**Post date:** [March 20, 2024, 7:48am UTC](https://discuss.elastic.co/t/search-query-not-fethcing-all-the-results/355790/1 "2024-03-20T07:48:28Z")

</div>

If am searching for **italian marble flooring** need to search for a combination of the below with the priority

**1. italian marble flooring**  
**2. italian marble**  
**3. marble flooring**  
**4. italian flooring**  
**5. italian**  
**6. marble**  
**7. flooring**

Query which am using to fetch the data.

```auto
Query

{
  "query": {
    "bool": {
      "should": [
        {
          "match": {
            "keywords.keyword_values": {
              "query": "italian marble flooring"
            }
          }
        }
      ]
    }
  }
}

```

**Doc 1**

```auto
{
  "keywords": [
    {
      "keyword_values": "italian marble flooring"
    }
  ]
}

```

**Doc 2**

```auto
{
  "keywords": [
    {
      "keyword_values": "italian marble"
    }
  ]
}

```

**Doc 3**

```auto
{
  "keywords": [
    {
      "keyword_values": "marble flooring"
    }
  ]
}

```

**Doc 4**

```auto
{
  "keywords": [
    {
      "keyword_values": "italian flooring"
    }
  ]
}

```

**Doc 5**

```auto
{
  "keywords": [
    {
      "keyword_values": "italian"
    }
  ]
}

```

**Doc 6**

```auto
{
  "keywords": [
    {
      "keyword_values": "marble"
    }
  ]
}

```

**Doc 7**

```auto
{
  "keywords": [
    {
      "keyword_values": "flooring"
    }
  ]
}

```

---

<div class="post-metadata">

**Author:** ![carly.richmond](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carly.richmond/32/104935_2.png) [@carly.richmond](https://discuss.elastic.co/u/carly.richmond)\
**Post date:** [March 20, 2024, 9:52am UTC](https://discuss.elastic.co/t/search-query-not-fethcing-all-the-results/355790/2 "2024-03-20T09:52:08Z")

</div>

Hi @Mohan_T,

I don't quite follow the issue you're having with the provided query. Which documents are you finding are not returned by your query that you expect to be returned?

---

<div class="post-metadata">

**Author:** ![Mohan\_T](https://avatars.discourse-cdn.com/v4/letter/m/34f0e0/32.png) [@Mohan\_T](https://discuss.elastic.co/u/Mohan_T)\
**Post date:** [March 20, 2024, 9:58am UTC](https://discuss.elastic.co/t/search-query-not-fethcing-all-the-results/355790/3 "2024-03-20T09:58:46Z")

</div>

Doc 1 only am getting, else am not getting.

---

<div class="post-metadata">

**Author:** ![carly.richmond](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carly.richmond/32/104935_2.png) [@carly.richmond](https://discuss.elastic.co/u/carly.richmond)\
**Post date:** [March 20, 2024, 10:07am UTC](https://discuss.elastic.co/t/search-query-not-fethcing-all-the-results/355790/4 "2024-03-20T10:07:00Z")

</div>

Ok, can you share your index mapping? Do you only have a keyword field for this data, or do you also have a corresponding text field?

---

<div class="post-metadata">

**Author:** ![Mohan\_T](https://avatars.discourse-cdn.com/v4/letter/m/34f0e0/32.png) [@Mohan\_T](https://discuss.elastic.co/u/Mohan_T)\
**Post date:** [March 20, 2024, 10:16am UTC](https://discuss.elastic.co/t/search-query-not-fethcing-all-the-results/355790/5 "2024-03-20T10:16:05Z")

</div>

```auto
{
  "indexname": {
    "mappings": {
      "properties": {
        "keywords": {
          "properties": {
            "keyword_values": {
              "type": "text"
            }
          }
        }
      }
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [March 20, 2024, 10:26am UTC](https://discuss.elastic.co/t/search-query-not-fethcing-all-the-results/355790/6 "2024-03-20T10:26:28Z")

</div>

Is that the mapping you are getting using the [get mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/8.12/indices-get-mapping.html)? If so please make sure to provide the full output.

In previous posts you have been using custom analysers for this field. Is this something you have now dropped?

---

<div class="post-metadata">

**Author:** ![Mohan\_T](https://avatars.discourse-cdn.com/v4/letter/m/34f0e0/32.png) [@Mohan\_T](https://discuss.elastic.co/u/Mohan_T)\
**Post date:** [March 20, 2024, 10:42am UTC](https://discuss.elastic.co/t/search-query-not-fethcing-all-the-results/355790/7 "2024-03-20T10:42:03Z")

</div>

this is the one am using, there is no custom analyzer

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [March 20, 2024, 11:25am UTC](https://discuss.elastic.co/t/search-query-not-fethcing-all-the-results/355790/8 "2024-03-20T11:25:34Z")

</div>

I just tested this and the query you privided returned all 7 test documents. Please provide a complete script (API calls to create mappings, index documents and run the query) that recreates your issue and also let us know which version of Elasticsearch you are using. Without this it is impossible to see what you have done wrong or left out, which results in a lot of wasted time.

---

<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:** [April 17, 2024, 11:26am UTC](https://discuss.elastic.co/t/search-query-not-fethcing-all-the-results/355790/9 "2024-04-17T11:26:33Z")

</div>

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