Skip to content
This repository was archived by the owner on Nov 7, 2025. It is now read-only.

Commit a7505f4

Browse files
committed
WIP
1 parent eb0b74c commit a7505f4

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

platform/persistence/elastic.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"github.com/QuesmaOrg/quesma/platform/config"
99
"github.com/QuesmaOrg/quesma/platform/elasticsearch"
1010
"github.com/QuesmaOrg/quesma/platform/logger"
11-
"github.com/QuesmaOrg/quesma/platform/types"
1211
"github.com/goccy/go-json"
1312
"io"
1413
"log"
@@ -60,20 +59,16 @@ func (p *ElasticJSONDatabase) refresh() error {
6059

6160
func (p *ElasticJSONDatabase) Put(key string, data string) error {
6261

63-
elasticsearchURL := fmt.Sprintf("%s/_update/%s", p.indexName, key)
62+
elasticsearchURL := fmt.Sprintf("%s/_doc/%s", p.indexName, key)
6463

6564
w := Wrapper{Content: data}
6665

67-
updateContent := types.JSON{}
68-
updateContent["doc"] = w
69-
updateContent["doc_as_upsert"] = true
70-
71-
jsonData, err := json.Marshal(updateContent)
66+
jsonData, err := json.Marshal(w)
7267
if err != nil {
7368
return err
7469
}
7570

76-
resp, err := p.httpClient.Request(context.Background(), "POST", elasticsearchURL, jsonData)
71+
resp, err := p.httpClient.Request(context.Background(), "PUT", elasticsearchURL, jsonData)
7772
if err != nil {
7873
return err
7974
}

0 commit comments

Comments
 (0)