我在elasticsearch中保存了文章,每篇文章都有字段类别,其中包含数字数组。
我有两台服务器,生产和开发,在两台服务器上都是相同的php代码,查询弹性,相同版本的弹性,php,....但在生产中我只得到N / A.
这是查询:
curl -XGET 'http://localhost:9200/prodproduct/_search?pretty' -H 'Content-Type: application/json' -d'
{
"size": 0,
"aggs": {
"domains": {
"terms": {
"field": "category.keyword",
"missing": "N/A",
"size": 10,
"order": {
"_count": "desc"
}
}
}
}
}'
重复一遍,这个查询在dev服务器上获取类别,但在生产时我只得到N / A:
{
"took" : 5,
"timed_out" : false,
"_shards" : {
"total" : 190,
"successful" : 190,
"failed" : 0
},
"hits" : {
"total" : 2584032,
"max_score" : 0.0,
"hits" : [ ]
},
"aggregations" : {
"domains" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
"buckets" : [
{
"key" : "N/A",
"doc_count" : 2584032
}
]
}
}
}
当我查询特定文章时,我看到它有带数字数组的字段类别。
可能有什么问题?
我花了几个小时试图找到解决方案但没有任何成功。
答案 0 :(得分:0)
我怀疑是一个映射问题,您的category
字段可能在开发和生产中有不同的映射。
如果是这种情况,您需要在生产中使用正确的映射创建新索引并重新索引数据,以便查询正常工作。