No, passing `fields` as a string value does not work. 

I think it's expecting an array, as best I can tell:

https://gitbox.apache.org/repos/asf?p=solr.git;a=blob;f=solr/core/src/java/org/apache/solr/request/json/RequestUtil.java;h=87ba244290d81ee865af9bb464b442f6da787ae8;hb=HEAD#l209

-Andrew

> On 7 Jan 2022, at 12:55, Mikhail Khludnev <m...@apache.org> wrote:
> 
> Hello, Andrew.
> 
> Could you try to pass a string value for "fields" property? That's what I
> see in TestJsonRequest.
> 
> On Fri, Jan 7, 2022 at 1:03 PM Andrew Hankinson
> <andrew.hankinson@rism.digital> wrote:
> 
>> Hello,
>> 
>> I am using the JSON Query API, and the 'fields' key does not work as
>> expected.
>> 
>> Using the following query with the `post` tool:
>> 
>> $> echo '{"query":"*:*", "fields": ["id"]}' | ./post -url
>> http://localhost:8983/solr/mycore/select -type application/json -out yes
>> -d
>> 
>> I get the full document back, not just the ID field. If, however, I use:
>> 
>> $> echo '{"query":"*:*", "params": {"fl": ["id"]}}' | ./post -url
>> http://localhost:8983/solr/mycore/select -type application/json -out yes
>> -d
>> 
>> Then the query works as expected.
>> 
>> Can anyone confirm this is an issue?
>> 
>> If it cannot be reproduced, I can dig deeper into my setup. I am using
>> some default `appends` for `fl` in the request handler for some custom
>> field processing for JSON fields, so it may be an issue with merging the
>> `fields` and the `fl` arrays? Not sure.
>> 
>> Thanks,
>> -Andrew
> 
> 
> 
> -- 
> Sincerely yours
> Mikhail Khludnev

Reply via email to