# Insert data successfully, but i can not find it

**URL:** <https://discuss.elastic.co/t/insert-data-successfully-but-i-can-not-find-it/138466>\
**Category:** Elasticsearch\
**Created:** [July 4, 2018, 1:46am UTC](https://discuss.elastic.co/t/insert-data-successfully-but-i-can-not-find-it/138466 "2018-07-04T01:46:27Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![benhairui](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/benhairui/32/60655_2.png) [@benhairui](https://discuss.elastic.co/u/benhairui)\
**Post date:** [July 4, 2018, 1:46am UTC](https://discuss.elastic.co/t/insert-data-successfully-but-i-can-not-find-it/138466/1 "2018-07-04T01:46:27Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [July 4, 2018, 4:56am UTC](https://discuss.elastic.co/t/insert-data-successfully-but-i-can-not-find-it/138466/2 "2018-07-04T04:56:29Z")

</div>

Could you provide a full recreation script as described in [About the Elasticsearch category](https://discuss.elastic.co/t/about-the-elasticsearch-category/21). 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.

---

<div class="post-metadata">

**Author:** ![benhairui](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/benhairui/32/60655_2.png) [@benhairui](https://discuss.elastic.co/u/benhairui)\
**Post date:** [July 4, 2018, 5:10am UTC](https://discuss.elastic.co/t/insert-data-successfully-but-i-can-not-find-it/138466/3 "2018-07-04T05:10:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [July 4, 2018, 5:38am UTC](https://discuss.elastic.co/t/insert-data-successfully-but-i-can-not-find-it/138466/4 "2018-07-04T05:38:42Z")

</div>

Please read exactly the provided instructions. I can't help with what you sent.

---

<div class="post-metadata">

**Author:** ![benhairui](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/benhairui/32/60655_2.png) [@benhairui](https://discuss.elastic.co/u/benhairui)\
**Post date:** [July 4, 2018, 5:57am UTC](https://discuss.elastic.co/t/insert-data-successfully-but-i-can-not-find-it/138466/5 "2018-07-04T05:57:04Z")

</div>

```
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
					}
				}
			}
		}
	}
}
```

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [July 4, 2018, 6:12am UTC](https://discuss.elastic.co/t/insert-data-successfully-but-i-can-not-find-it/138466/6 "2018-07-04T06:12:10Z")

</div>

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:

```auto
DELETE index
PUT index/_doc/1
{
  "foo": "bar"
}
GET index/_search
{
  "query": {
    "match": {
      "foo": "bar"
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![benhairui](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/benhairui/32/60655_2.png) [@benhairui](https://discuss.elastic.co/u/benhairui)\
**Post date:** [July 4, 2018, 6:19am UTC](https://discuss.elastic.co/t/insert-data-successfully-but-i-can-not-find-it/138466/7 "2018-07-04T06:19:27Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [July 4, 2018, 6:34am UTC](https://discuss.elastic.co/t/insert-data-successfully-but-i-can-not-find-it/138466/8 "2018-07-04T06:34:15Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![benhairui](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/benhairui/32/60655_2.png) [@benhairui](https://discuss.elastic.co/u/benhairui)\
**Post date:** [July 4, 2018, 6:36am UTC](https://discuss.elastic.co/t/insert-data-successfully-but-i-can-not-find-it/138466/9 "2018-07-04T06:36:46Z")

</div>

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 !

---

<div class="post-metadata">

**Author:** ![benhairui](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/benhairui/32/60655_2.png) [@benhairui](https://discuss.elastic.co/u/benhairui)\
**Post date:** [July 5, 2018, 7:29am UTC](https://discuss.elastic.co/t/insert-data-successfully-but-i-can-not-find-it/138466/10 "2018-07-05T07:29:33Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 2, 2018, 7:29am UTC](https://discuss.elastic.co/t/insert-data-successfully-but-i-can-not-find-it/138466/11 "2018-08-02T07:29:53Z")

</div>

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