Aggregations with concatArrays and indexOfArray

I need to match and return with 10 items before and after the matched item. I am trying with below code but it outputs only 20 items when i came with 87 items. With items i expect 87 * 21 so around 1800 to be in the output. Can someone help me check what i am doing wrong here:

{
  logs: {
    $slice: [
      {
        $concatArrays: [
          {
            $slice: [
              "$logs",
              {
                $max: [
                  0,
                  {
                    $subtract: [
                      {
                        $indexOfArray: [
                          "$logs.message",
                          "TV014367",
                        ],
                      },
                      10,
                    ],
                  },
                ],
              },
              10,
            ],
          },
          {
            $slice: [
              "$logs",
              {
                $indexOfArray: [
                  "$logs.message",
                  "TV014367",
                ],
              },
              11,
            ],
          },
          {
            $slice: [
              "$logs",
              {
                $add: [
                  {
                    $indexOfArray: [
                      "$logs.message",
                      "TV014367",
                    ],
                  },
                  1,
                ],
              },
              10,
            ],
          },
        ],
      },
      {
        $min: [
          {
            $add: [
              {
                $subtract: [
                  {
                    $size: "$logs",
                  },
                  {
                    $indexOfArray: [
                      "$logs.message",
                      "TV014367",
                    ],
                  },
                ],
              },
              {
                $cond: [
                  {
                    $gte: [
                      {
                        $indexOfArray: [
                          "$logs.message",
                          "TV014367",
                        ],
                      },
                      0,
                    ],
                  },
                  1,
                  0,
                ],
              },
            ],
          },
          20,
        ],
      },
    ],
  },
}