Elasticsearch result empty mid-word

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

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

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:

{
  "_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.

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

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.

1 Like

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:

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:

{
  "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.

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

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