conductor icon indicating copy to clipboard operation
conductor copied to clipboard

ElasticSearch input and output fields

Open jvemugunta opened this issue 8 years ago • 4 comments

In the mapping files mappings_docType_workflow.json and mappings_docType_task.json

the input and output fileds are defined as

"input": { "type": "string", "index": "analyzed" }, "output": { "type": "string", "index": "analyzed" }

We want to use rely on Elastic Search Engine for querying for Tasks and Workflows instead of Conductor. Use Conductor as pure workflow engine and write all of the searches using Elastic Engine

Declaring the fields as above will be of no help from Elastic Search Perspective as JSON data is being converted as simple strings as below https://github.com/Netflix/conductor/blob/9f221071f0177b17a5fc803f26cd7fab7a2c06b5/common/src/main/java/com/netflix/conductor/common/run/TaskSummary.java#L89-L96

How can we store as JSON payload and make all of the fields inside the JSON payload as Indexable.

I tried changing to

"input": { "type": "object", "dynamic": true }, "output": { "type": "object", "dynamic": true },

But this seems to be not working.

Appreciate any pointers

jvemugunta avatar Jul 29 '18 05:07 jvemugunta

Hi @v1r3n,

I think you are one who wrote this code. Can you reply on how we can store the input and output as JSON data while fully indexed searches. This will help conductor project to get best out of Conductor and Search Engine.

jvemugunta avatar Jul 29 '18 05:07 jvemugunta

@jvemugunta The reason for making this a string is that different tasks could potentially have different data types for the same field. e.g. one task might output a field as string vs. another as integer or a complex object. The conflicting data types will cause issues with indexing as Elasticsearch indexing will fail. Given the fields are analyzed as string, you still should be able to search for tasks and workflows based on the values of the input/output.

v1r3n avatar Jul 29 '18 18:07 v1r3n

Hi @v1r3n , thanks for the reply. If you look at the datatypes of Input and Output fields. they are defined as

private Map<String, Object> input = new HashMap<>(); private Map<String, Object> output = new HashMap<>();

Converting these fields as Strings, make the strings unsearchable from Elastic Search. The bigger goal for plugging Conductor into Elastic Search Engine will be lost because the input and outout data is NOT searchable

We can still allow complex types into MAP object.

For example : private Map<String, Object> input = new HashMap<>(); input.put("age", new Integer(25)); will make the JSON data easily searchable

The dynamic mapping will turn as below

input": { "dynamic": "true", "properties": { "age": { "type": "int", "fields": { "keyword": { "type": "keyword", "ignore_above": 256 } } } } }

Assume we make as string as below private Map<String, Object> input = new HashMap<>(); input.put("fileName", "f1");

now the dynamic mapping turns out as input": { "dynamic": "true", "properties": { "fileName": { "type": "text", "fields": { "keyword": { "type": "keyword", "ignore_above": 256 } } } } }

This way input and out can work with all complex types. I have craeted the pull request and it is a simple change. Please review once you get some time. I have tested with Conflicting data types and it is working great.

https://github.com/Netflix/conductor/pull/685

My 2 cents - If we just conclude as strings, the power of ES is lost and clients prefer to get input and output filed values as JSON data instead of strings.

jvemugunta avatar Jul 29 '18 19:07 jvemugunta

Closing this as the associated PR has been closed.

apanicker-nflx avatar Mar 12 '19 00:03 apanicker-nflx