Sorry, I should have also included my `post` tool command for clarity:

$> echo '{"query":"*:*", "fields": "id,type"}' | ./post -url 
http://localhost:8983/solr/mycore/select -type application/json -out yes -d

This returns all the fields, not just the `id` and `type` fields. 

I'm on 8.11.1

> 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