# Failed to create outliear detection

**URL:** <https://discuss.elastic.co/t/failed-to-create-outliear-detection/337878>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-machine-learning\
**Created:** [July 7, 2023, 9:49am UTC](https://discuss.elastic.co/t/failed-to-create-outliear-detection/337878 "2023-07-07T09:49:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![JasonREC](https://avatars.discourse-cdn.com/v4/letter/j/858c86/32.png) [@JasonREC](https://discuss.elastic.co/u/JasonREC)\
**Post date:** [July 7, 2023, 9:49am UTC](https://discuss.elastic.co/t/failed-to-create-outliear-detection/337878/1 "2023-07-07T09:49:25Z")

</div>

Hi,

I was trying to create a machine learning which is simply to identify a distinct record  
Below is my data:

 ![raw1](https://us1.discourse-cdn.com/elastic/original/3X/3/c/3cdda70c7cf9bfe653e05e43cd0c1361dc5d027d.png)  
 ![raw2](https://us1.discourse-cdn.com/elastic/original/3X/d/e/de544366506e650a96caa175f17cbb2466610ff8.png)

In my index, I have 20 documents, and 7 fields  
Codenum is a keyword  
A,B,C,V+,V-,P are boolean

only the first and second documents' C field and P field are different from the other 18 documents

my goal is to see if Elastic ML can identify that document 1 and document 2 is different from others

but I have encouter the following issue:

 ![ml_i1](https://us1.discourse-cdn.com/elastic/original/3X/e/4/e47e4c2be99f1c4064fc37da35ee17626e684856.png)  
 ![ml_i2](https://us1.discourse-cdn.com/elastic/original/3X/a/8/a896892304cb75f04bc1a1ae16abc1f990ce81c2.png)

it says my data has no numeric value and data cannot have keyword, I am not sure how can fix it,  
Can anyone help?

---

<div class="post-metadata">

**Author:** ![eMitch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/emitch/32/93607_2.png) [@eMitch](https://discuss.elastic.co/u/eMitch)\
**Post date:** [July 7, 2023, 12:37pm UTC](https://discuss.elastic.co/t/failed-to-create-outliear-detection/337878/2 "2023-07-07T12:37:40Z")

</div>

[Outlier detection](https://www.elastic.co/guide/en/machine-learning/7.17/ml-dfa-limitations.html#dfa-od-field-type-docs-limitations) requires the field types to be either `numeric` or `boolean`.

Can you change the field `Codenum` from `code-2` to `2` and set the field type accordingly? or is the 'code' portion of the value important in this scenario?

---

<div class="post-metadata">

**Author:** ![JasonREC](https://avatars.discourse-cdn.com/v4/letter/j/858c86/32.png) [@JasonREC](https://discuss.elastic.co/u/JasonREC)\
**Post date:** [July 10, 2023, 1:45am UTC](https://discuss.elastic.co/t/failed-to-create-outliear-detection/337878/3 "2023-07-10T01:45:18Z")

</div>

Hi @eMitch ,

Thanks for the reply.

The Codenum field is like an identifier for me to know which device has problem.  
if getting rid of it, I think there would be a way to identifer which device has distinct pattern

---

<div class="post-metadata">

**Author:** ![eMitch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/emitch/32/93607_2.png) [@eMitch](https://discuss.elastic.co/u/eMitch)\
**Post date:** [July 11, 2023, 1:17am UTC](https://discuss.elastic.co/t/failed-to-create-outliear-detection/337878/4 "2023-07-11T01:17:41Z")

</div>

Yea, that makes sense. I don't mean to remove the field. However, if you change the mapping to an integer, you can still filter on it as well as allow the ML to work properly.

---

<div class="post-metadata">

**Author:** ![JasonREC](https://avatars.discourse-cdn.com/v4/letter/j/858c86/32.png) [@JasonREC](https://discuss.elastic.co/u/JasonREC)\
**Post date:** [July 11, 2023, 1:59am UTC](https://discuss.elastic.co/t/failed-to-create-outliear-detection/337878/5 "2023-07-11T01:59:31Z")

</div>

Hi @eMitch,

I got your point, and I have a try. now it works as expected!

Thanks!

---

<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 8, 2023, 1:59am UTC](https://discuss.elastic.co/t/failed-to-create-outliear-detection/337878/6 "2023-08-08T01:59:53Z")

</div>

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