简体   繁体   English

将文件发布到solr时出现未知命令错误

[英]unknown command error while posting files to solr

I am trying to post the following json format of the file to solr 我试图将以下json格式的文件发布到solr

{"userName": "Bill", "stars": 4, "review_id": "-TsVN230RCkLYKBeLsuz7A", "type": "review", "business_name": "Eric Goldberg, MD", "user_id": "zvJCcrpm2yOZrxKffwGQLA", "text": "Dr. Goldberg has been my doctor for years and I like him. I've found his office to be fairly efficient. Today I actually got to see the doctor a few minutes early! \\n\\nHe seems very engaged with his patients and his demeanor is friendly, yet authoritative. \\n\\nI'm glad to have Dr. Goldberg as my doctor."}

However I get the error 但是我得到了错误

Response: {"responseHeader":{"status":400,"QTime":32}," error":{"msg":"Unknown command 'user_name' at [12]","code":400}}

while I am trying to do 虽然我想做

post.sh -c coreName fileName.json

This is driving me crazy. 这真让我抓狂。 I have unloaded the core and created it again to see if previous attempts to post files is causing this error. 我已卸载核心并再次创建它以查看以前尝试发布文件是否导致此错误。 But that did not help. 但这没有帮助。

Solr is looking for a command (like 'add') when you send an object, so you need to either add the command, as such: 当你发送一个对象时,Solr正在寻找一个命令(比如'add'),所以你需要添加命令,如下:

{"add": {"doc":{"userName": "Bill", "stars": 4, "review_id": "-TsVN230RCkLYKBeLsuz7A", "type": "review", "business_name": "Eric Goldberg, MD", "user_id": "zvJCcrpm2yOZrxKffwGQLA", "text": "Dr. Goldberg has been my doctor for years and I like him.  I've found his office to be fairly efficient.  Today I actually got to see the doctor a few minutes early!  \n\nHe seems very engaged with his patients and his demeanor is friendly, yet authoritative.    \n\nI'm glad to have Dr. Goldberg as my doctor."}}}

Or place it in an array: 或者将它放在一个数组中:

[{"userName": "Bill", "stars": 4, "review_id": "-TsVN230RCkLYKBeLsuz7A", "type": "review", "business_name": "Eric Goldberg, MD", "user_id": "zvJCcrpm2yOZrxKffwGQLA", "text": "Dr. Goldberg has been my doctor for years and I like him.  I've found his office to be fairly efficient.  Today I actually got to see the doctor a few minutes early!  \n\nHe seems very engaged with his patients and his demeanor is friendly, yet authoritative.    \n\nI'm glad to have Dr. Goldberg as my doctor."}]

See also: https://wiki.apache.org/solr/UpdateJSON 另见: https//wiki.apache.org/solr/UpdateJSON

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM