大数据

大数据

Elastic报错:Fielddata is disabled on text fields by default

python李魔佛 发表了文章 • 3 个评论 • 8973 次浏览 • 2018-11-09 15:57 • 来自相关话题

Elastic 报错: {
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "Fielddata is disabled on text fields by default. Set fielddata=true on [state] 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."
}
],
"type": "search_phase_execution_exception",
"reason": "all shards failed",
"phase": "query",
"grouped": true,
"failed_shards": [
{
"shard": 0,
"index": "bank",
"node": "HuFlhO8OSLSGr3RP6J2z6Q",
"reason": {
"type": "illegal_argument_exception",
"reason": "Fielddata is disabled on text fields by default. Set fielddata=true on [state] 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."
}
}
]
},
"status": 400
}
 
解决办法:
查询的时候添加keyword
 
如上面的查询使用的是:{"size":0,
"aggs":{"group_by_state":
{
"terms":{"field":"state"}
}}
}
就会报错。
 
使用下面的语句就不会错误了{"size":0,
"aggs":{"group_by_state":
{
"terms":{"field":"state.keyword"}
}}

原文链接:
http://30daydo.com/article/366
  查看全部
Elastic 报错: 
{
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "Fielddata is disabled on text fields by default. Set fielddata=true on [state] 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."
}
],
"type": "search_phase_execution_exception",
"reason": "all shards failed",
"phase": "query",
"grouped": true,
"failed_shards": [
{
"shard": 0,
"index": "bank",
"node": "HuFlhO8OSLSGr3RP6J2z6Q",
"reason": {
"type": "illegal_argument_exception",
"reason": "Fielddata is disabled on text fields by default. Set fielddata=true on [state] 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."
}
}
]
},
"status": 400
}

 
解决办法:
查询的时候添加keyword
 
如上面的查询使用的是:
{"size":0,
"aggs":{"group_by_state":
{
"terms":{"field":"state"}
}}
}

就会报错。
 
使用下面的语句就不会错误了
{"size":0,
"aggs":{"group_by_state":
{
"terms":{"field":"state.keyword"}
}}
}
 
原文链接:
http://30daydo.com/article/366
 

Elastic报错:Fielddata is disabled on text fields by default

python李魔佛 发表了文章 • 3 个评论 • 8973 次浏览 • 2018-11-09 15:57 • 来自相关话题

Elastic 报错: {
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "Fielddata is disabled on text fields by default. Set fielddata=true on [state] 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."
}
],
"type": "search_phase_execution_exception",
"reason": "all shards failed",
"phase": "query",
"grouped": true,
"failed_shards": [
{
"shard": 0,
"index": "bank",
"node": "HuFlhO8OSLSGr3RP6J2z6Q",
"reason": {
"type": "illegal_argument_exception",
"reason": "Fielddata is disabled on text fields by default. Set fielddata=true on [state] 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."
}
}
]
},
"status": 400
}
 
解决办法:
查询的时候添加keyword
 
如上面的查询使用的是:{"size":0,
"aggs":{"group_by_state":
{
"terms":{"field":"state"}
}}
}
就会报错。
 
使用下面的语句就不会错误了{"size":0,
"aggs":{"group_by_state":
{
"terms":{"field":"state.keyword"}
}}

原文链接:
http://30daydo.com/article/366
  查看全部
Elastic 报错: 
{
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "Fielddata is disabled on text fields by default. Set fielddata=true on [state] 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."
}
],
"type": "search_phase_execution_exception",
"reason": "all shards failed",
"phase": "query",
"grouped": true,
"failed_shards": [
{
"shard": 0,
"index": "bank",
"node": "HuFlhO8OSLSGr3RP6J2z6Q",
"reason": {
"type": "illegal_argument_exception",
"reason": "Fielddata is disabled on text fields by default. Set fielddata=true on [state] 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."
}
}
]
},
"status": 400
}

 
解决办法:
查询的时候添加keyword
 
如上面的查询使用的是:
{"size":0,
"aggs":{"group_by_state":
{
"terms":{"field":"state"}
}}
}

就会报错。
 
使用下面的语句就不会错误了
{"size":0,
"aggs":{"group_by_state":
{
"terms":{"field":"state.keyword"}
}}
}
 
原文链接:
http://30daydo.com/article/366