ES查询报错解决
报错信息:
Fielddata is disabled on text fields by default.Set fielddata=true on [responsetime] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead.
原因:
字段类型为text,不支持直接用字段名查询,应该用字段名.keyword;
注意:
自动映射类型,数据类型自动映射为第一次收到数据时的类型,后续即使写数据时改变数据类型,但存储的还是第一次映射类型。
如:
第一次存储的数据类型为text,即使后续写入的数据类型为long,但写入数据库后还是text。