### Elasticsearch Version

8.9.0

### Installed Plugins

_No response_

### Java Version

_bundled_

### OS Version

any

### Problem Description

If the context text supplied to the Question Answering task is longer than the model's `max_sequence_length` and `truncate` is set to `none` then inference on the model fails with the message:

```
status_exception: question answering result has invalid dimension, expected 2 found [6] 
```
<img width="1438" alt="Screenshot 2023-07-25 at 08 21 37" src="https://github.com/elastic/elasticsearch/assets/2353640/12d296f6-03b2-4cda-89ce-7399348c4104">


### Steps to Reproduce

Use long input text to the question answering task


### Work Aroundf
The fix is to truncate the context which unfortunately may remove the part of the document containing the answer. For reference the call is documented here

```
POST _ml/trained_models/distilbert-base-cased-distilled-squad/deployment/_infer
{
  "docs":[{ "text_field": "question answering context"}],
  "inference_config": {
    "question_answering": {
      "question": "The question to ask",
      "tokenization": {
        "bert": {
          "truncate": "second",
          "span": -1          
        }
      }
    }
  }
}
````

x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/inference/nlp/QuestionAnsweringProcessorTests.java
public void testProcessor() throws IOException {
        String question = "is Elasticsearch fun?";
        String input = "Pancake day is fun with Elasticsearch and little red car";
        BertTokenization tokenization = new BertTokenization(false, true, 384, Tokenization.Truncate.NONE, 128);
        BertTokenizer tokenizer = BertTokenizer.builder(TEST_CASED_VOCAB, tokenization).build();
        QuestionAnsweringConfig config = new QuestionAnsweringConfig(question, 1, 10, new VocabularyConfig(""), tokenization, "prediction");
        QuestionAnsweringProcessor processor = new QuestionAnsweringProcessor(tokenizer);
        TokenizationResult tokenizationResult = processor.getRequestBuilder(config)
            .buildRequest(List.of(input), "1", Tokenization.Truncate.NONE, 128)
            .tokenization();
        assertThat(tokenizationResult.anyTruncated(), is(false));
        assertThat(tokenizationResult.getTokenization(0).tokenIds().length, equalTo(END_TOKEN_SCORES.length));
        
        assertThat(tokenizationResult.getTokenization(0).seqPairOffset(), equalTo(7));
        double[][][] scores = { { START_TOKEN_SCORES }, { END_TOKEN_SCORES } };
        NlpTask.ResultProcessor resultProcessor = processor.getResultProcessor(config);
        PyTorchInferenceResult pyTorchResult = new PyTorchInferenceResult(scores);
        QuestionAnsweringInferenceResults result = (QuestionAnsweringInferenceResults) resultProcessor.processResult(
            tokenizationResult,
            pyTorchResult
        );
        
        assertThat(result.getScore(), closeTo(0.05264939, 1e-6));
        
        assertThat(result.getStartOffset(), equalTo(8));
        assertThat(result.getEndOffset(), equalTo(48));
        assertThat(result.getAnswer(), equalTo(input.substring(8, 48)));
    }
    public void testTopScoresRespectsAnswerLength() {
        int seq2Start = 8;