# Elasticsearch result empty mid-word

**URL:** <https://forum.litium.com/t/elasticsearch-result-empty-mid-word/3152>\
**Category:** Questions\
**Tags:** accelerator, search, litium-8\
**Created:** [November 23, 2023, 6:39am UTC](https://forum.litium.com/t/elasticsearch-result-empty-mid-word/3152 "2023-11-23T06:39:20Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![wiseby](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/wiseby/32/959_2.png) [@wiseby](https://forum.litium.com/u/wiseby)\
**Post date:** [November 23, 2023, 6:39am UTC](https://forum.litium.com/t/elasticsearch-result-empty-mid-word/3152/1 "2023-11-23T06:39:20Z")

</div>

I have a special case where my result disappears when searching. My result dissapears in the middle of typing and reappears as I countinue typing. It’s always on the same character. Searching “fatvär” returns a result but as soon I type “fatvärm”, te result dissapears completely. “fatvärma” (continous to write the search) will then return a result again.

The result are the same in Prod/Staging (where the result is the same and where the issue was found), but locally I have the issue only for the category search (finding the products but not the category that has a match in name).

Litium version: _8.12.0_

---

<div class="post-metadata">

**Author:** ![wiseby](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/wiseby/32/959_2.png) [@wiseby](https://forum.litium.com/u/wiseby)\
**Post date:** [November 23, 2023, 7:02am UTC](https://forum.litium.com/t/elasticsearch-result-empty-mid-word/3152/2 "2023-11-23T07:02:57Z")

</div>

Here is an example from Kibana DevConsole where I have removed all but the match on name.

```auto
POST test-project_35.aq.categorydocument.sv-se/_search?typed_keys=true
{
  "from": 0,
  "query": {
    "bool": {
      "must": [
        {
          "bool": {
            "should": [
              {
                "match": {
                  "name": {
                    "fuzziness": "AUTO",
                    "query": "fatvärm",
                    "boost": 2
                  }
                }
              }
            ]
          }
        }
      ]
    }
  },
  "size": 10,
  "_source": {
    "includes": [
      "categorySystemId",
      "name"
    ]
  }
}

```

This document is present:

```auto
{
  "_index": "test-project_35.v1.categorydocument.sv-se",
  "_type": "_doc",
  "_id": "177756df-e4ad-4cef-91c9-5915096a92ba6409562c-4616-4d2d-a668-b35ec80f4159",
  "_score": 4.8758354,
  "_source": {
    "categorySystemId": "177756df-e4ad-4cef-91c9-5915096a92ba",
    "name": "IBC- och fatvärmare"
  }
}

```

This yields no hits.

---

<div class="post-metadata">

**Author:** ![Totte](https://avatars.discourse-cdn.com/v4/letter/t/c5a1d2/32.png) [@Totte](https://forum.litium.com/u/Totte)\
**Post date:** [November 27, 2023, 9:11am UTC](https://forum.litium.com/t/elasticsearch-result-empty-mid-word/3152/3 "2023-11-27T09:11:28Z")

</div>

Are you making the query to the correct index?

You query:  
`test-project_35.aq.categorydocument.sv-se`

But it looks like your index is named  
`test-project_35.v1.categorydocument.sv-se`

---

<div class="post-metadata">

**Author:** ![patric.forsgard](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/patric.forsgard/32/10_2.png) [@patric.forsgard](https://forum.litium.com/u/patric.forsgard)\
**Post date:** [November 27, 2023, 11:52am UTC](https://forum.litium.com/t/elasticsearch-result-empty-mid-word/3152/4 "2023-11-27T11:52:16Z")

</div>

the `aq` (alias wuery) and `aw` (alias write) is index alias that pointing to the active index name. When you rebuilding offline the index name is switching between `v1` and `v2` and to avoid exception when query or writing the alias is used for these operations to always execute on the correct active index for the requested method.

---

<div class="post-metadata">

**Author:** ![wiseby](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/wiseby/32/959_2.png) [@wiseby](https://forum.litium.com/u/wiseby)\
**Post date:** [November 29, 2023, 11:51am UTC](https://forum.litium.com/t/elasticsearch-result-empty-mid-word/3152/5 "2023-11-29T11:51:13Z")

</div>

Yes I see that I accidentaly pasted the wrong query with different index. The problem is still present with the use of one index. Here comes another one:

```auto
POST pkprodukter_36.aq.categorydocument.sv-se/_search?typed_keys=true
{
  "from": 0,
  "query": {
    "bool": {
      "must": [
        {
          "bool": {
            "should": [
              {
                "match": {
                  "name": {
                    "fuzziness": "AUTO",
                    "query": "fatvärma",
                    "boost": 2
                  }
                }
              }
            ]
          }
        }
      ]
    }
  },
  "size": 10,
  "_source": {
    "includes": [
      "categorySystemId",
      "name"
    ]
  }
}

```

Result:

```auto
{
  "took" : 2,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 1,
      "relation" : "eq"
    },
    "max_score" : 5.0092163,
    "hits" : [
      {
        "_index" : "pkprodukter_36.v1.categorydocument.sv-se",
        "_type" : "_doc",
        "_id" : "177756df-e4ad-4cef-91c9-5915096a92ba6409562c-4616-4d2d-a668-b35ec80f4159",
        "_score" : 5.0092163,
        "_source" : {
          "categorySystemId" : "177756df-e4ad-4cef-91c9-5915096a92ba",
          "name" : "IBC- och fatvärmare"
        }
      }
    ]
  }
}

```

When I search “fatvärm” the hits are empty.

---

<div class="post-metadata">

**Author:** ![patric.forsgard](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/patric.forsgard/32/10_2.png) [@patric.forsgard](https://forum.litium.com/u/patric.forsgard)\
**Post date:** [November 29, 2023, 12:55pm UTC](https://forum.litium.com/t/elasticsearch-result-empty-mid-word/3152/6 "2023-11-29T12:55:42Z")

</div>

Try to use the explain API to find out why an document matching an specific query or the other way around.

[Explain API | Elasticsearch Reference [6.0] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-explain.html)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/12eddac3b8b661de1db86af10ac8151b571e6fb9.png) [@system](https://forum.litium.com/u/system)\
**Post date:** [December 27, 2023, 12:56pm UTC](https://forum.litium.com/t/elasticsearch-result-empty-mid-word/3152/7 "2023-12-27T12:56:07Z")

</div>

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