Remember an elasticsearch, es modification of the mapping caused the query to fail.

The problem is this, querying the es interface reports an error, and the test environment is the same as the official environment code. The test environment is fine.

报错是 fieddata is disabled on text fields by default set fielddata=true on status in order to load fielddata in memory by ...

 By looking at the mapping, the sort field of the query contains status, but it is of text type. This field is a field I added later. The test environment is keyword type

 How did the problem arise. In the program, I called es to modify the mapping, but the official environment is always inserting data. So the index is assigned to text by default.

The test environment has no data inserted. So it is directly modified to keyword.

How to solve: directly modify fielddata=true

PUT shanghaidianli_shebei_xunjian/_doc/_mapping
{
  "properties": {
    “status": { 
      "type":     "text",
      "fielddata": true
    }
  }
}

Guess you like

Origin blog.csdn.net/haoweng4800/article/details/124636622