I insert data into es successfully, but when i add two fields, the return is successful, but when i search it with id, i find it without the two fields added.
Help me please? thank you!
Could you provide a full recreation script as described in About the Elasticsearch category. It will help to better understand what you are doing. Please, try to keep the example as simple as possible.
A full reproduction script will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.
Thanks for your reply!
This is my mapping,:
{
"my_index": {
"mappings": {
"car": {
"source": {
"includes": [
"stockIsExist",
"avgSales",
"createDate",
"innerColorName",
"coordinate",
"status",
"innerColor",
"sourceProvince",
"shopCodes",
"updateDate",
"id",
"guidePrice",
"sourceArea",
"brandCode",
"sourceCity",
"nickName",
"cloudWarHouse",
"salesArea",
"bizCode",
"surfaceColor",
"seriesCode",
"seriesName",
"brandName",
"shopCode",
"modelCode",
"externalCode",
"modelName",
"storeType",
"sourceType",
"avgUv",
"stockCapacity",
"surfaceColorName",
"wholesalePrice",
"shopProvince",
"shopCity",
"shopArea",
"analysis_name",
"object_header",
"is_primary_table_document_record"
]
},
"dynamic_templates": [
{
"texts": {
"match": "analysis_name_alone",
"match_mapping_type": "string",
"mapping": {
"analyzer": "self_define_analyzer",
"type": "text"
}
}
},
{
"strings": {
"match_mapping_type": "string",
"mapping": {
"type": "keyword"
}
}
}
],
"properties": {
"analysis_name": {
"type": "text",
"analyzer": "self_define_analyzer"
},
"analysis_name_field_brandName": {
"type": "keyword"
},
"analysis_name_field_externalCode": {
"type": "keyword"
},
"analysis_name_field_modelName": {
"type": "keyword"
},
"analysis_name_field_seriesName": {
"type": "keyword"
},
"analysis_name_field_surfaceColorName": {
"type": "keyword"
},
"avgSales": {
"type": "double",
"index": false
},
"avgUv": {
"type": "double",
"index": false
},
"bizCode": {
"type": "keyword"
},
"brandCode": {
"type": "keyword"
},
"brandName": {
"type": "text",
"index": false
},
"cloudWarHouse": {
"type": "integer",
"index": false
},
"coordinate": {
"type": "geo_point",
"index": false
},
"createDate": {
"type": "date",
"index": false,
"format": "yyyy-MM-dd HH:mm:ss"
},
"externalCode": {
"type": "text",
"index": false
},
"guidePrice": {
"type": "long"
},
"id": {
"type": "keyword"
},
"innerColor": {
"type": "keyword"
},
"innerColorName": {
"type": "keyword",
"index": false
},
"is_primary_table_document_record": {
"type": "boolean"
},
"modelCode": {
"type": "keyword"
},
"modelName": {
"type": "text",
"index": false
},
"nickName": {
"type": "keyword"
},
"salesArea": {
"type": "keyword"
},
"seriesCode": {
"type": "keyword"
},
"seriesName": {
"type": "text",
"index": false
},
"shopArea": {
"type": "keyword"
},
"shopCity": {
"type": "keyword"
},
"shopCode": {
"type": "keyword"
},
"shopCodes": {
"type": "keyword"
},
"shopProvince": {
"type": "keyword"
},
"sourceArea": {
"type": "keyword"
},
"sourceCity": {
"type": "keyword"
},
"sourceProvince": {
"type": "keyword"
},
"sourceType": {
"type": "integer"
},
"status": {
"type": "integer"
},
"stockCapacity": {
"type": "integer"
},
"stockIsExist": {
"type": "integer"
},
"storeType": {
"type": "keyword",
"index": false
},
"surfaceColor": {
"type": "keyword"
},
"surfaceColorName": {
"type": "text",
"index": false
},
"updateDate": {
"type": "date",
"index": false,
"format": "yyyy-MM-dd HH:mm:ss"
},
"wholesalePrice": {
"type": "long",
"index": false
}
}
}
}
}
}
the added fields are avgSales and avgUv, i insert data by bulkReqeust. when I end inserting, some data has avgSales and avgUv field, but other has not. Then i changed one data's id, insert again, it don't work. It seems some data failed to insert or lose this data, but i get the data'sreturn result is successful by bulkResponseList
Please read exactly the provided instructions. I can't help with what you sent.
Sorry for that. I format this script with some tool.Can it work?
Thanks for your guide and patience.
{
"my_index": {
"mappings": {
"car": {
"source": {
"includes": [
"stockIsExist",
"avgSales",
"createDate",
"innerColorName",
"coordinate",
"status",
"innerColor",
"sourceProvince",
"shopCodes",
"updateDate",
"id",
"guidePrice",
"sourceArea",
"brandCode",
"sourceCity",
"nickName",
"cloudWarHouse",
"salesArea",
"bizCode",
"surfaceColor",
"seriesCode",
"seriesName",
"brandName",
"shopCode",
"modelCode",
"externalCode",
"modelName",
"storeType",
"sourceType",
"avgUv",
"stockCapacity",
"surfaceColorName",
"wholesalePrice",
"shopProvince",
"shopCity",
"shopArea",
"analysis_name",
"object_header",
"is_primary_table_document_record"
]
},
"dynamic_templates": [{
"texts": {
"match": "analysis_name_alone",
"match_mapping_type": "string",
"mapping": {
"analyzer": "self_define_analyzer",
"type": "text"
}
}
},
{
"strings": {
"match_mapping_type": "string",
"mapping": {
"type": "keyword"
}
}
}
],
"properties": {
"analysis_name": {
"type": "text",
"analyzer": "self_define_analyzer"
},
"analysis_name_field_brandName": {
"type": "keyword"
},
"analysis_name_field_externalCode": {
"type": "keyword"
},
"analysis_name_field_modelName": {
"type": "keyword"
},
"analysis_name_field_seriesName": {
"type": "keyword"
},
"analysis_name_field_surfaceColorName": {
"type": "keyword"
},
"avgSales": {
"type": "double",
"index": false
},
"avgUv": {
"type": "double",
"index": false
},
"bizCode": {
"type": "keyword"
},
"brandCode": {
"type": "keyword"
},
"brandName": {
"type": "text",
"index": false
},
"cloudWarHouse": {
"type": "integer",
"index": false
},
"coordinate": {
"type": "geo_point",
"index": false
},
"createDate": {
"type": "date",
"index": false,
"format": "yyyy-MM-dd HH:mm:ss"
},
"externalCode": {
"type": "text",
"index": false
},
"guidePrice": {
"type": "long"
},
"id": {
"type": "keyword"
},
"innerColor": {
"type": "keyword"
},
"innerColorName": {
"type": "keyword",
"index": false
},
"is_primary_table_document_record": {
"type": "boolean"
},
"modelCode": {
"type": "keyword"
},
"modelName": {
"type": "text",
"index": false
},
"nickName": {
"type": "keyword"
},
"salesArea": {
"type": "keyword"
},
"seriesCode": {
"type": "keyword"
},
"seriesName": {
"type": "text",
"index": false
},
"shopArea": {
"type": "keyword"
},
"shopCity": {
"type": "keyword"
},
"shopCode": {
"type": "keyword"
},
"shopCodes": {
"type": "keyword"
},
"shopProvince": {
"type": "keyword"
},
"sourceArea": {
"type": "keyword"
},
"sourceCity": {
"type": "keyword"
},
"sourceProvince": {
"type": "keyword"
},
"sourceType": {
"type": "integer"
},
"status": {
"type": "integer"
},
"stockCapacity": {
"type": "integer"
},
"stockIsExist": {
"type": "integer"
},
"storeType": {
"type": "keyword",
"index": false
},
"surfaceColor": {
"type": "keyword"
},
"surfaceColorName": {
"type": "text",
"index": false
},
"updateDate": {
"type": "date",
"index": false,
"format": "yyyy-MM-dd HH:mm:ss"
},
"wholesalePrice": {
"type": "long",
"index": false
}
}
}
}
}
}
Let me extract the most important part of the guide I linked to:
A typical script like this one can be copied and pasted in Kibana Dev Console by any reader. It will definitely help to play with your example and provide a fix for your script.
If you don't provide it, there is a chance that nobody can help.
Here I can not copy and paste your "script" to reproduce the problem.
I can copy this script though and play with it:
DELETE index
PUT index/_doc/1
{
"foo": "bar"
}
GET index/_search
{
"query": {
"match": {
"foo": "bar"
}
}
}
Maybe what i said is not clear. I insert data with java code. And I don't know the problem can reappear with kibana.
If it is necessary, i need some time to produce the script.
Thanks for your reply again.
May be something wrong in your code but without seeing what you are doing, it's hard to tell.
Anyway, most of time, when people try by themselves to reproduce the problem with a simple Kibana script and can't (which I'm expecting in your case), they start to read their code again to understand where the issue is coming from.
If you don't succeed, share your java code.
I understant what you say. I will check my code with my guys. If it does't work, I will consider to share my code with you!
Thanks for your reply again and guide and patience !
@dadoonet
Thanks for your reply about my question.
I have found problem about it. It is from my workmate. I send whole data right. He lose some data when insert. We are search the problem.
Thanks for your data again.
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.