我在单个实例中使用solr 5.5版本。我试图将以下数据索引为一条记录:
{
"MLId": "00021BF6-BCC7-4F2E-8B8F-02587310A1B4",
"PublishDate": "2015-06-03",
"CompanyName": "GLI Finance Limited",
"Ticker": "GLI",
"Primary": "1",
"Exchange": "Channel Islands Securities Exchange",
"Line1": "Sarnia House",
"Line2": "Le Truchot",
"Line3": "St Peter Port",
"Line4": "Guernsey GY1 4NA",
"Line5": "Channel Islands",
"Country": "GBR",
"Phone": "",
"WebAddress": "http://www.glifund.com",
"NoOfEmployees": "",
"Turnover": "580000",
"TurnoverUSD": "992600.0000",
"FinancialYearEnd": "--12--",
"overView": "GLI Finance is a closed-ended investment company. It invests in senior secured loans and syndicated corporate loans issued primarily by middle market US companies. Its portfolio investment is managed by T2 Advisers. The company operates in the Channel Islands, the UK and the Cayman Islands. It is headquartered in St. Peter Port, Guernsey.|The company recorded revenues of £584.4 thousand (approximately $963.1 thousand) in the fiscal year ended December 2014. Its net loss was £13,626.4 thousand (approximately $22,457.6 thousand) in fiscal 2014.|",
"MajorProductsServices": "GLI Finance is a closed-ended investment company. The company's key activities include the following: Activities: Invests in senior secured loans and syndicated corporate loans issued primarily by middle market US companies",
"KeyEmployeesCount": "8",
"_childDocuments_": [
{
"FullName": "Geoffrey Richard Miller",
"JobTitle": "Chief Executive Officer and Executive Director",
"Board": "Executive Board"
},
{
"FullName": "Emma Stubbs",
"JobTitle": "Chief Financial Officer",
"Board": "Executive Board"
},
{
"FullName": "Patrick Anthony Seymour Firth",
"JobTitle": "Chairman",
"Board": "Non Executive Board"
},
{
"FullName": "Frederick Peter Forni",
"JobTitle": "Non-Executive Director",
"Board": "Non Executive Board"
},
{
"FullName": "James Henry Carthew",
"JobTitle": "Non-Executive Director",
"Board": "Non Executive Board"
},
{
"FullName": "Marc Krombach",
"JobTitle": "Managing Director",
"Board": "Senior Management"
},
{
"FullName": "Andrew Whelan",
"JobTitle": "Director, Lending",
"Board": "Senior Management"
},
{
"FullName": "Louise Beaumont",
"JobTitle": "Head, Public Affairs and Marketing",
"Board": "Senior Management"
}
],
"LocationsSubsidiariesCount": "5",
"Subsidiary": [
{
"SubsidiaryName": "GLIF BMS Holdings Limited",
"SubsidiaryAddressLine1": "",
"SubsidiaryAddressLine2": "",
"SubsidiaryAddressLine3": "",
"SubsidiaryAddressLine4": "",
"SubsidiaryAddressLine5": "",
"SubsidiaryAddressCountry": "GBR"
},
{
"SubsidiaryName": "Secured Loan Investments Limited",
"SubsidiaryAddressLine1": "",
"SubsidiaryAddressLine2": "",
"SubsidiaryAddressLine3": "",
"SubsidiaryAddressLine4": "",
"SubsidiaryAddressLine5": "Guernsey",
"SubsidiaryAddressCountry": "GBR"
},
{
"SubsidiaryName": "BMS Finance AB Limited",
"SubsidiaryAddressLine1": "",
"SubsidiaryAddressLine2": "",
"SubsidiaryAddressLine3": "",
"SubsidiaryAddressLine4": "",
"SubsidiaryAddressLine5": "",
"SubsidiaryAddressCountry": "GBR"
},
{
"SubsidiaryName": "NVF Tech Limited",
"SubsidiaryAddressLine1": "",
"SubsidiaryAddressLine2": "",
"SubsidiaryAddressLine3": "",
"SubsidiaryAddressLine4": "",
"SubsidiaryAddressLine5": "",
"SubsidiaryAddressCountry": "GBR"
},
{
"SubsidiaryName": "GLI Investments Holdings Sarl",
"SubsidiaryAddressLine1": "",
"SubsidiaryAddressLine2": "",
"SubsidiaryAddressLine3": "",
"SubsidiaryAddressLine4": "",
"SubsidiaryAddressLine5": "",
"SubsidiaryAddressCountry": "LUX"
}
]
}
我收到未知命令MLID错误:
你能帮我创建索引吗?
谢谢, Srilu
答案 0 :(得分:1)
简短回答:把[]放在整个结构周围,它应该可以工作。
答案很长:Solr接受3 different forms中的JSON:
你在这里遇到了用例2,所以Solr抱怨说它看到的第一件事不是已知命令之一。通过将对象放入数组,切换到类型3,它应该工作。
P.S。您的具体示例似乎有其他嵌套对象数组,可能会停止索引(特别是“辅助”)。但这是一个单独的问题/问题。