Directed graph (or) merge vertices with same name

I am trying to create a flow path for different user activities. For example, users can be redirected from url 'A' to url 'B' or to 'C' etc. I would like to calculate the top redirections. I want to show this using graph visualization.

I have created a data model this way:
{field:12345, 'from_url':'A', 'to_url': 'B' }
{field:12345, 'from_url':'A', 'to_url': 'C' }
{field:12345, 'from_url':'B', 'to_url': 'C' }
{field:12345, 'from_url':'A', 'to_url': 'B' }

So, when searching for field:12345 , a graph like this is what I am looking for(counts on edges is optional):

elastic1

I modeled my graph with vertices from_url and to_url. I also want my graph to produce analytics of all data, so I increased sample_size, set use_significance to false and min_doc_count as 1 as mentioned in here.

The problem is with x-pack Graph in Kibana, I am only able to get graph this way:

image

I understand the meaning for this graph as vertices are colored. But, this is getting clumsy as the number of vertices increase. The related url (Ex: url 'B') vertices are not close to each other, they are far apart on the graph. Is there any way to merge the vertices which have common name (Ex: url 'B')? and produce a directed graph similar to first visualization?
If not, do I have to change my data model? or does any other visualization help in my usecase?

Thanks !

The elastic Graph is undirected. One way around this is to introduce node terms that represent the route e.g. A->B.
Here's an example mapping and data for your example:

DELETE test
PUT test
{
  "settings": {
	"number_of_replicas": 0,
	"number_of_shards": 1
  },
  "mappings": {
	"doc":{
	  "properties": {
		"node":{"type":"keyword"},
		"route":{"type":"keyword"}
	  }
	}
  }
}

POST /test/edge/_bulk
{ "index" : {} }
{ "node" : "A", "route":"A->B" }
{ "index" : {} }
{ "node" : "B", "route":"A->B" }
{ "index" : {} }
{ "node" : "A", "route":"A->C" }
{ "index" : {} }
{ "node" : "C", "route":"A->C" }
{ "index" : {} }
{ "node" : "B", "route":"B->C" }
{ "index" : {} }
{ "node" : "C", "route":"B->C" }
{ "index" : {} }
{ "node" : "A", "route":"A->B" }
{ "index" : {} }
{ "node" : "B", "route":"A->B" }

..and here's the resulting graph visualization:

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