---
title: "solr的unique-key的fieldtype必须为string类型"
author: "eric_wyf"
date: "2011-08-09T18:51:39Z"
tags: []
categories: ["开源软件"]
slug: "solr-unique-key-fieldtype-string"
draft: false
lastmod: "2011-08-09T19:19:55Z"
id: 1143830
url: "https://eric-wyf.iteye.com/blog/1143830"
---

今天发现了一个以前没有注意的问题，solr的schema.xml配置文件中，unique-key的field必须是string类型，否则会报错。

org.apache.solr.common.SolrException: QueryElevationComponent requires the schema to have a uniqueKeyField implemented using StrField

 

解决办法，删除solrconfig.xml配置文件中的Elevation组件的配置

&lt;searchComponent name="elevator" class="solr.QueryElevationComponent" &gt;

&lt;requestHandler name="/elevate" class="solr.SearchHandler" startup="lazy" &gt;

 

 

solr wiki中提到

[http://wiki.apache.org/solr/QueryElevationComponent#elevate.xml](http://wiki.apache.org/solr/QueryElevationComponent#elevate.xml)