I want to push the following Json data using Python in elasticsearch, I used the following code but there is no data in the index.
json data :
[
"break",
false,
-1314177328.9280925,
[
-107585784.0005331,
1173232087.3724098,
[
true,
-1841424252.6783514,
true,
"typical",
true,
false
],
false,
1593426885.6051607,
true
],
"parent",
false
]
If the json is malformed elastic will reject the document, try to use logstash http input plugin with stdout rubydbg to see what you are really sending. check if the json is well structured with an online json checker
There are restrictions in what JSON you can index into Elasticsearch, and what you have posted is not valid in Elasticsearch. The root bust be a well formed JSON object and can not be an array. Elasticsearch is also not schemaless, so once a field has been mapped it can not accept values that are not aligned to this mapping.
hi @A_Mightiev, Jason data is valid, I checked
It is valid JSON, but not in a form Elasticsearch will accept.
Can you help me @Christian_Dahlqvist ? I am a beginner and the result of this task is very important to me:(
Have you looked at the Elasticsearch getting started guide and the examples available there?
no i didn't
Then please do so. You will need to learn about how Elasticsearch works if you are going to use it. The section on mapping describes how document structure and mapping works, and should explain why your document will not work in Elasticsearch.
I can't find a document that explains what Jsons are accepted by Elasticsearch... I would be grateful if you could send me a link or a document that can help me and improve my situation.
I added a link to the documentation on mapping to my earlier response. A document must be an object with at least one field, e.g. {"field:"value"}
. An array at the highest level is not acceptable.
Furthermore each field must have a single mapping. Although a field can contain an array, all values within the array must be of the same type, so you can e.g. not mix strings, numbers and objects in an array.
This blog post may also be useful, although it is quite old and quite a few things have changed since.
Thank you very much, you helped me a lot. I will definitely read the points you said
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.