我有像这样的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
我在调试字段中收到错误。
&#34;错误&#34;:{ &#34; msg&#34;:&#34; 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]&#34 ;, &#34; trace&#34;:&#34; org.apache.solr.common.SolrException: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] \ n \达 org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:342)\ n \达 org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:143)\ n \达 org.apache.solr.core.SolrCore.execute(SolrCore.java:1984)\ n \达 org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:829)\ n \达 org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:446)\ n \达 org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:220)\ n \达 org.eclipse.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1419)\ n \达 org.eclipse.jetty.servlets.CrossOriginFilter.handle(CrossOriginFilter.java:247)\ n \达 org.eclipse.jetty.servlets.CrossOriginFilter.doFilter(CrossOriginFilter.java:210)\ n \达 org.eclipse.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1419)\ n \达 org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:455)\ n \达 org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)\ n \达 org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557)\ n \达 org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)\ n \达 org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1075)\ n \达 org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:384)\ n \达 org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)\ n \达 org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1009)\ n \达 org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)\ n \达 org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)\ n \达 org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)\ n \达 org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)\ n \达 org.eclipse.jetty.server.Server.handle(Server.java:368)\ n \达 org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489)\ n \达 org.eclipse.jetty.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:53)\ n \达 org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:942)\ n \达 org.eclipse.jetty.server.AbstractHttpConnection $ RequestHandler.headerComplete(AbstractHttpConnection.java:1004)\ n \达 org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:640)\ n \达 org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)\ n \达 org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:72)\ n \达 org.eclipse.jetty.server.bio.SocketConnector $ ConnectorEndPoint.run(SocketConnector.java:264)\ n \达 org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)\ n \达 org.eclipse.jetty.util.thread.QueuedThreadPool $ 3.run(QueuedThreadPool.java:543)\ n \达 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.17.110:8983/solr/gettingstarted_shard2_replica2] \ n \达 org.apache.solr.client.solrj.impl.LBHttpSolrClient.request(LBHttpSolrClient.java:349)\ n \达 org.apache.solr.handler.component.HttpShardHandlerFactory.makeLoadBalancedRequest(HttpShardHandlerFactory.java:226)\ n \达 org.apache.solr.handler.component.HttpShardHandler $ 1.call(HttpShardHandler.java:224)\ n \达 org.apache.solr.handler.component.HttpShardHandler $ 1.call(HttpShardHandler.java:184)\ n \达 java.util.concurrent.FutureTask.run(FutureTask.java:262)\ n \达 java.util.concurrent.Executors $ RunnableAdapter.call(Executors.java:471)\ n \达 java.util.concurrent.FutureTask.run(FutureTask.java:262)\ n \达 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)\ n \达 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: 意外的docvalues键入SORTED_SET for field&#39; vendor&#39; (预期=排序)。使用UninvertingReader或索引 docvalues。\ n \达 org.apache.solr.client.solrj.impl.HttpSolrClient.executeMethod(HttpSolrClient.java:556)\ n \达 org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:233)\ n \达 org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:225)\ n \达 org.apache.solr.client.solrj.impl.LBHttpSolrClient.doRequest(LBHttpSolrClient.java:370)\ n \达 org.apache.solr.client.solrj.impl.LBHttpSolrClient.request(LBHttpSolrClient.java:338)\ n \ t ... 9更多\ n&#34;, &#34;代码&#34; 500}}
请帮帮我。
答案 0 :(得分:2)
我在尝试对字段进行排序时遇到了同样的问题&#39; ViewCount&#39;:
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.
看起来错误是由&#34;多值&#34;该字段的属性&#34; ViewCount&#34;。此外,作为doc,字段&#34;索引&#34;财产必须是真实的。
我有一个核心名称&#34; bigdata&#34;。
我的解决方案:
删除&#34; bigdata&#34;
中的所有文件卷曲http://localhost:8983/solr/bigdata/update - 数据&#39; :&#39; -H&#39;内容类型:text / xml;字符集= UTF-8&#39; 卷曲http://localhost:8983/solr/bigdata/update - 数据&#39;&#39; -H&#39;内容类型:text / xml;字符集= UTF-8&#39;
将字段更改为long(或任何不是多值的类型)并编入索引
卷曲-X POST -H&#39;内容类型:application / json&#39; --data-binary&#39; { &#34;替换字段&#34;:{ &#34;名称&#34;:&#34;观看次数&#34 ;, &#34;类型&#34;:&#34;长&#34 ;, &#34;多值&#34;:假, &#34;索引&#34;:真, &#34;存储&#34;:真 } }&#39; http://localhost:8983/solr/bigdata/schema
重新加载&#34; bigdata&#34;
http://localhost:8983/solr/admin/cores?action=RELOAD&core=bigdata
将您的数据导入&#34; bigdata&#34;再次
重新加载&#34; bigdata&#34;
http://localhost:8983/solr/admin/cores?action=RELOAD&core=bigdata
问题1:删除所有文档可能会让某人感到痛苦。我尝试了上面的步骤而没有删除并重新导入所有文档,但没有工作。看起来像Crypt经历的那样。
问题2:如果您使用seamless mode。我的意思是你不要手动编辑模式,你需要在&#34; solrconfig.xml&#34;中设置模式不可变。在重新导入数据之前。相关文档为here
答案 1 :(得分:0)
如果为false,则使该特定字段的索引为=“ true”;