Hbase 二级索引 Solr int字段排序问题 can not sort on multivalued field
Hbase Solr 同步二級索引后,進行int字段排序時報錯
報錯如下
{"responseHeader":{"zkConnected":true,"status":400,"QTime":75,"params":{"q":"*:*","sort":"hbase_indexer_fn_read_num desc","_":"1576474856934"}},"error":{"metadata":["error-class","org.apache.solr.common.SolrException","root-error-class","org.apache.solr.common.SolrException"],"msg":"can not sort on multivalued field: hbase_indexer_fn_read_num","code":400}}提示不能是multivalued屬性
多值在solr中顯示如下,帶中括號
false 情況下應(yīng)為下圖,不帶中括號
修改?schema.xml 文件,?multivalued = "false"
<field name="hbase_indexer_fn_read_num" type="string" indexed="true" multiValued="false" stored="true"/>更新solr配置
更新配置文件; solrctl instancedir --update vt_index /home/jast/opt/hbase-indexer/vt_weibo_index 更新collection; solrctl collection --reload vt_index再次寫入數(shù)據(jù),排序查詢后還是提示異常,
原因:新版的solr,將默認(rèn)的字段docValues="true"
最后加入?docValues="false"
<field name="hbase_indexer_fn_read_num" type="string" indexed="true" docValues="false" multiValued="false" stored="true"/>再次查詢,返回正常
docValues作用
docValues: 如果這個字段應(yīng)該有文檔值(doc values),設(shè)置為true。文檔值在門
面搜索,分組,排序和函數(shù)查詢中會非常有用。雖然不是必須的,而且會導(dǎo)致生成
索引變大變慢,但這樣設(shè)置會使索引加載更快,更加NRT友好,更高的內(nèi)存使用效率。
然而也有一些使用限制:目前僅支持StrField, UUIDField和所有 Trie*Fields,
并且依賴字段類型, 可能要求字段為單值(single-valued)的,必須的或者有默認(rèn)值。
?參考鏈接:https://www.jianshu.com/p/2f4a2f77eaad
總結(jié)
以上是生活随笔為你收集整理的Hbase 二级索引 Solr int字段排序问题 can not sort on multivalued field的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Hbase1.2数据导入2.0
- 下一篇: Canal Mysql binlog 同