I have jenkins logs in a json format. (taken with the API)
the logs have different types of value to the same key:
'''
{
"_class":"hudson.model.StringParameterValue",
"name":"MANIFEST_REVISION",
"value":"master"
},
{
"_class":"hudson.model.BooleanParameterValue",
"name":"CROSS_CLUSTER",
"value":false
},
'''
and more. when try to upload them using elastic-python, I got this error:
BadRequestError(400, 'illegal_argument_exception', 'mapper [actions.parameters.value] cannot be changed from type [text] to [boolean]')
I do some digging, but didn't find a solution for that.
any idea what I can do to upload the json successfully?
The issue here is that you didn't explicitly mapped the fields, so Elasticsearch will try to map it according to the first value it receives for any field, in your case it received a value of true or false and then mapped the field as a boolean field, but you have other documents where the value of this field can be something else.
You will need to map the field as keyword since it can has values that are not only true or false.
You nee to have the correct mapping for every field, however you can use a dynamic template that will, for example, map every string that elasticsearch receives as a keyword field.
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.