我有一个这样的 solr 模式
<fields>
<field name="id" type="string" indexed="false" stored="true" required="true" />
<field name="product" type="string" indexed="true" stored="true" required="true" />
<field name="vendor" type="string" indexed="true" stored="true" required="true" />
<field name="language" type="string" indexed="true" stored="true" required="true" />
<field name="TotalInvoices" type="float" indexed="true" stored="true" required="true"/>
</fields>
我正在查询模式,结果是这样的
product,Vendor,Invoice
abc,vendor1,49206.75999999998
abc,vendor2,35654.98000000001
abc,vendor2,94861.25999999998
abc,vendor3,990.9600000000012
abc,vendor3,990.9600000000012
abc,vendor3,990.960000000001
我想按供应商字段对结果进行分组,所以我发布了这样的查询
http://localhost:8983/solr/gettingstarted_shard2_replica2/select?q=abc
&fl=product%2Cvendor%2CTotalInvoices
&wt=json
&indent=true
&debugQuery=true
&group=true
&group.field=vendor
我在调试字段中收到一个错误。
"error":{ "msg":"org.apache.solr.client.solrj.SolrServerException: No live SolrServers available to handle this request:[http://10.192.17.110:7574/solr/gettingstarted_shard2_replica1, http://10.192.17.110:8983/solr/gettingstarted_shard1_replica2, http://10.192.17.110:7574/solr/gettingstarted_shard1_replica1, http://10.192.17.110:8983/solr/gettingstarted_shard2_replica2]", "trace":"org.apache.solr.common.SolrException: org.apache.solr.client.solrj.SolrServerException: No live SolrServers available to handle this request:[http://10.192.17.110:7574/solr/gettingstarted_shard2_replica1, http://10.192.17.110:8983/solr/gettingstarted_shard1_replica2, http://10.192.17.110:7574/solr/gettingstarted_shard1_replica1, http://10.192.17.110:8983/solr/gettingstarted_shard2_replica2]\n\tat org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:342)\n\tat org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:143)\n\tat org.apache.solr.core.SolrCore.execute(SolrCore.java:1984)\n\tat org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:829)\n\tat org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:446)\n\tat org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:220)\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1419)\n\tat org.eclipse.jetty.servlets.CrossOriginFilter.handle(CrossOriginFilter.java:247)\n\tat org.eclipse.jetty.servlets.CrossOriginFilter.doFilter(CrossOriginFilter.java:210)\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1419)\n\tat org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:455)\n\tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)\n\tat org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557)\n\tat org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)\n\tat org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1075)\n\tat org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:384)\n\tat org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)\n\tat org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1009)\n\tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)\n\tat org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)\n\tat org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)\n\tat org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)\n\tat org.eclipse.jetty.server.Server.handle(Server.java:368)\n\tat org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489)\n\tat org.eclipse.jetty.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:53)\n\tat org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:942)\n\tat org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1004)\n\tat org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:640)\n\tat org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)\n\tat org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:72)\n\tat org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:264)\n\tat org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)\n\tat org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)\n\tat java.lang.Thread.run(Thread.java:745)\nCaused by: org.apache.solr.client.solrj.SolrServerException: No live SolrServers available to handle this request:[http://10.192.17.110:7574/solr/gettingstarted_shard2_replica1, http://10.192.17.110:8983/solr/gettingstarted_shard1_replica2, http://10.192.17.110:7574/solr/gettingstarted_shard1_replica1, http://10.192.17.110:8983/solr/gettingstarted_shard2_replica2]\n\tat org.apache.solr.client.solrj.impl.LBHttpSolrClient.request(LBHttpSolrClient.java:349)\n\tat org.apache.solr.handler.component.HttpShardHandlerFactory.makeLoadBalancedRequest(HttpShardHandlerFactory.java:226)\n\tat org.apache.solr.handler.component.HttpShardHandler$1.call(HttpShardHandler.java:224)\n\tat org.apache.solr.handler.component.HttpShardHandler$1.call(HttpShardHandler.java:184)\n\tat java.util.concurrent.FutureTask.run(FutureTask.java:262)\n\tat java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)\n\tat java.util.concurrent.FutureTask.run(FutureTask.java:262)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)\n\t... 1 more\nCaused by: org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException: Error from server at http://10.192.17.110:8983/solr/gettingstarted_shard1_replica2: unexpected docvalues type SORTED_SET for field 'vendor' (expected=SORTED). Use UninvertingReader or index with docvalues.\n\tat org.apache.solr.client.solrj.impl.HttpSolrClient.executeMethod(HttpSolrClient.java:556)\n\tat org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:233)\n\tat org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:225)\n\tat org.apache.solr.client.solrj.impl.LBHttpSolrClient.doRequest(LBHttpSolrClient.java:370)\n\tat org.apache.solr.client.solrj.impl.LBHttpSolrClient.request(LBHttpSolrClient.java:338)\n\t... 9 more\n", "code":500}}
请帮帮我。
最佳答案
我在尝试对“ViewCount”字段进行排序时遇到了同样的问题:
unexpected docvalues type SORTED_SET for field 'ViewCount' (expected=SORTED) ...
错误理解: 来自 here
Any Trie* numeric fields, date fields and EnumField.`enter code here`
If the field is single-valued (i.e., multi-valued is false), Lucene will use the NUMERIC type.
If the field is multi-valued, Lucene will use the SORTED_SET type.
看起来错误是由字段“ViewCount”的“多值”属性引起的。此外,作为 doc ,该字段的“索引”属性必须为真。
我有一个核心名称“bigdata”。
我的解决方案:
删除“bigdata”中的所有文档
curl http://localhost:8983/solr/bigdata/update --data ':' -H '内容类型:文本/xml;字符集=utf-8' curl http://localhost:8983/solr/bigdata/update --data '' -H '内容类型:文本/xml; charset=utf-8'
将字段更改为 long(或任何非多值类型)并建立索引
curl -X POST -H 'Content-type:application/json' --data-binary '{ “替换字段”:{ “名称”:“查看次数”, “类型”:“长”, “多值”:假, “索引”:真实的, “存储”:真 } }' http://localhost:8983/solr/bigdata/schema
重新加载“大数据”
http://localhost:8983/solr/admin/cores?action=RELOAD&core=bigdata
再次将您的数据导入“大数据”
重新加载“大数据”
http://localhost:8983/solr/admin/cores?action=RELOAD&core=bigdata
问题 1:删除所有文档可能对某些人来说很痛苦。我在没有删除并重新导入所有文档的情况下尝试了上述步骤,但没有奏效。看起来这就是 Crypt 所经历的。
问题 2:如果您使用 seamless mode .我的意思是您不手动编辑模式,您需要在重新导入数据之前在“solrconfig.xml”中设置模式不可变。相关文件是here
关于indexing - Solr 结果分组错误。字段 'vendor' 的意外文档值类型 SORTED_SET(预期=排序),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30347597/