Skip to content

JSON booleans not serialized correctly through query parameters (Client 8_0) #245

Open
@Grinnz

Description

@Grinnz

After updating to use Client Direct::8_0, we encountered an issue where passing a JSON boolean as the value of track_total_hits in the search method resulted in an HTTP query string passing the value 1, which changes the behavior for this parameter. If instead \1 is passed, it is serialized in the query string as the string true which works correctly.

Retrieves incorrect result (tracks only 1 hit):

$es->search(index => $index_name, track_total_hits => JSON::PP::true, body => \%search_body);

Trace log:

curl -H "Content-type: application/json" -XGET 'http://localhost:9200/units/_search?pretty=true&track_total_hits=1' ...

Retrieves correct total hits:

$es->search(index => $index_name, track_total_hits => \1, body => \%search_body);

Trace log:

curl -H "Content-type: application/json" -XGET 'http://localhost:9200/units/_search?pretty=true&track_total_hits=true' ...

With Client Direct::7_0, both queries pass the correct string 'true' as the query string value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions