Not sure your overall goal but a good way to do this would be to use in ingestion pipeline.
When you ingest data you specify the pipeline ID and that will do the combining of the names. You can set the mapping for the field to whatever you want.
PUT _ingest/pipeline/set_full_name
{
"description": "Creates full name based on first and last",
"processors": [
{
"set": {
"field": "full_name",
"value": "{{first_name}} {{last_name}}"
}
}
]
}
POST my-index-000001/_doc/1?pipeline=set_full_name
{
"first_name": "Aaron",
"last_name": "Nimocks"
}
Dear aaron-nimocks, thank you very much for your reply. I can understand what you said.In fact, I am new to Elasticsearch and have no big goals to achieve.
The reason I ask this question is because when I read the official elasticsearch documentation (v7.10), copy_to confuses me.
I have experimented with two situations myself.
In the first, I set the target field of the copy_to to keyword type ,and the index can be created successfully, but the results cannot be searched according to my expectations.
In the second case, I set the target type of the copy_to field to search_as_you_type type,and the index can be created successfully, and the results can be searched as expected.
So I fell into a huge confusion. Did i do something wrong, or the copy_to field does have type restrictions? I hope my description is clear and I hope you can give me some advice.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.