Elastica icon indicating copy to clipboard operation
Elastica copied to clipboard

(Question) Search Option "seq_no_primary_term" support

Open ryu818 opened this issue 1 year ago • 2 comments

Hello all. It seems that “seq_no_primary_term” is not yet supported in Elastica's search Option value, is there any reason not to allow this to be specified? https://github.com/ruflin/Elastica/blob/8.x/src/Search.php#L406-L421

Official Documentation https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html#search-search-api-request-body

ryu818 avatar Oct 23 '24 23:10 ryu818

I would like to add some information. After I implemented the retrieval of if_primary_term and if_seq_no, I found that calling save does not result in a Conflict error:

$Index->save(
    $data,
    [
        'if_primary_term' => (int)$primaryTerm,
        'if_seq_no' => (int)$seqNo,
    ]
);

Upon investigation, I discovered that the options list does not include if_primary_term and if_seq_no:

Target Code

I believe that changing $options = $doc->getOptions($endpoint->getParamWhitelist()); would properly set the available option values. Is my understanding correct?

ryu818 avatar Oct 24 '24 02:10 ryu818

Hi @ryu818 , I think the main reason is that it is not supported yet is that nobody got around to add it. As you already digged into the code quite a bit, what do you think about opening a PR with the proposed change? This should make also the discussion if it works (or not) etc. much easier. I would really appreciate the contribution.

ruflin avatar Oct 29 '24 08:10 ruflin