Some doubt about ingest-attachment

Hi,team.
I am new to ElasticSearch.Now I'm working in a project which provide a jsp to search some documents(docx,pdf and so on) of user uploaded.
I'm using ingest-attachment within ElasticSearch7.0.1,shown in the following code:
1.declare attachment plugin to ElasticSearch:

PUT _ingest/pipeline/attachment
{
  "description" : "Extract attachment information",
  "processors" : [
	{
	  "attachment" : {
		"field" : "data"
	  }
	}
  ]
}

2.create a document with attachment:

PUT my_index/_doc?pipeline=attachment
{
  "data": "base64..."
}

3.now,I can using rest api to search,
my question is,can I achieve to post the document which content is same as the previous document(I hope the ElasticSearch will updatethe index instead of create anthor one).
my idea is my program will stored a UUID and the name of document as a key-value into redis,so I will check whether the filename exist or not prior to when I upload a same name of file(Suppose a file with the same name has the same content).If it already exist,the program will using 'PUT my_index/_doc/UUID' to update index,otherwise the program will create a new UUID to map current document and save them to Redis,At last the program will call 'POST my_index/_doc/UUID' to create data.
Is it a good idea?If not,What is the best,please help,tks.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.