1.安装head插件时,记性npm install时提示错误:This failure might be due to the use of legacy binary “node”
原因:可能是因为安装了node而不是nodejs导致,使用如下指令安装sudo apt-get install nodejs-legacy后重新进行npm install即可正常
2.安装grunt插件:
sudo npm install -g grunt-cli
3.head插件无法连上集群
vim $ES_HOME$/config/elasticsearch.yml
# 增加如下字段
http.cors.enabled: true
http.cors.allow-origin: "*"
4.查询时显示:no [query] registered for [filtered]
查询语句:
{
"query" : {
"filtered" : {
"filter" : {
"range" : {
"age" : { "gt" : 30 } <1> }
},
"query" : {
"match" : {
"last_name" : "Smith" <2> }
}
}
}
}
其中的filtered已经弃用,应该使用如下查询方法:
{
"query": {
"bool": {
"filter": {
"range": {
"age": { "gt": 20 } }
},
"must": {
"match": {
"last_name": "Smith" }
}
}
}
}
5.进行统计的时候使用如下语句报错:
{
"aggs": {
"all_interests": {
"terms": {
"field": "interests"
}
}
}
}
报错:
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "Fielddata is disabled on text fields by default. Set fielddata=true on [interests] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory."
}
]
原因:
Fielddata can consume a lot of heap space, especially when loading high cardinality text fields. Once fielddata has been loaded into the heap, it remains there for the lifetime of the segment.
(fielddata会消耗大量的栈内存,尤其在进行加载文本的时候,所以一单fielddata完成了加载,就会一直存在。)
Also, loading fielddata is an expensive process which can cause users to experience latency hits. This is why fielddata is disabled by default.
(同时,加载fielddata的过程中可能造成延迟命中,所以fielddata默认是关闭的。)
参考如下Doc
解决方法:
{
"aggs": {
"all_interests": {
"terms": {
"field": "interests.keyword"
}
}
}
}