3

我有一个像这样的 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

我在调试字段中收到此错误。

“错误”:{ “msg”:“org.apache.solr.client.solrj.SolrServerException:没有可用的实时 SolrServers 可用于处理此请求:[ 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 .common.SolrException:org.apache.solr.client.solrj.SolrServerException:没有可用于处理此请求的实时 SolrServers:[ http://10.192.17.110:7574/solr/gettingstarted_shard2_replica1http://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。句柄(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 章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)\n引起:org.apache.solr.client.solrj.SolrServerException:没有可用的实时 SolrServers 可用于处理此请求:[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)\n原因:org.apache.solr.client.solrj.SolrServerException: 没有可用的实时 SolrServers 可用于处理此请求:[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)\n原因:org.apache.solr.client.solrj.SolrServerException: 没有可用的实时 SolrServers 可用于处理此请求:[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: 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 更多\n原因:org.apache.solr.client.solrj.impl。HttpSolrClient$RemoteSolrException:来自服务器的错误 http://10.192.17.110:8983/solr/gettingstarted_shard1_replica2:字段“供应商”的意外文档值类型 SORTED_SET(预期 = SORTED)。使用 UninvertingReader 或 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 更多\n", “代码”:500}}

请帮帮我。

4

2 回答 2

2

尝试对字段“ViewCount”进行排序时遇到了同样的问题:

 unexpected docvalues type SORTED_SET for field 'ViewCount' (expected=SORTED) ...

错误理解:从这里

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,该字段的“索引”属性必须为真。

我有一个核心名称“大数据”。

我的解决方案:

问题1:删除所有文档可能会让某人感到痛苦。我尝试了上述步骤而没有删除并重新导入所有文档,但没有奏效。看起来这就是 Crypt 所经历的。

问题2:如果您使用无缝模式。我的意思是您不手动编辑架构,您需要在重新导入数据之前在“solrconfig.xml”中设置架构不可变。相关文档在这里

于 2017-07-19T03:38:07.183 回答
0

如果为假,则使该特定字段的 indexed="true";

于 2020-01-09T13:15:20.153 回答