Questions Tagged With elasticsearchhttps://answers.axonivy.com/tags/elasticsearch/?type=rss&user=Adrian%20Imfeldquestions tagged <span class="tag">elasticsearch</span>enWed, 31 Jul 2019 04:33:14 -0400Elasticsearch fail because auto-conversion changes String values into Datehttps://answers.axonivy.com/questions/3903/elasticsearch-fail-because-auto-conversion-changes-string-values-into-date<p>We get an error of the Elasticsearch by saving a BusinessObject over the ivy.repo with a field of type <code>Map&lt; String,String &gt;</code>.</p> <pre><code>Elasticsearch update index of document failed because of: {"root_cause":[{"type":"illegal_argument_exception","reason":"mapper [details.data.Value1] of different type, current_type [text], merged_type [date]"}],"type":"illegal_argument_exception","reason":"mapper [details.data.Value1] of different type, current_type [text], merged_type [date]"}</code></pre> <p>The problem ist clear. The field "details.data.Value1" is a date field and i try to store a String.</p> <p><strong>But</strong> the definition of our BusinessObject is different to that!<br> The field "data" of the "detail" object is defined as a <code>Map&lt; String,String &gt;</code>.<br> We get this error when we run the following code in an IvyScript (we used a helper class for Maps, because IvyScript is not able to handle double generics).</p> <pre><code>JobDetail detail = new JobDetail(); Helper helper = new Helper(); helper.setParam("Value1", (new Date()).toString()); detail.data = helper.getParams(); job.details.add(detail); detail = new JobDetail(); helper.setParam("Value1", "foo"); detail.data = helper.getParams(); job.details.add(detail);</code></pre> <p>Why does Elasticsearch change the given attribute to a date field, although we just fill in String values?<br> Furthermore we defined the value as a Map of Sting-String value pairs.<br> Is there a solution of this issue?</p> <p>We decided not to use JSON objects instead of our Map, because of the easy handling in further uses.</p>Adrian ImfeldWed, 31 Jul 2019 04:33:14 -0400https://answers.axonivy.com/questions/3903/elasticsearch-fail-because-auto-conversion-changes-string-values-into-datebusiness-dataelasticsearchivyscript