Hi I have data that looks like this:
PUT g_explore/_doc/0
{ "lot_num":"A1", "out_batch": "BATCH940","input_batch": "BATCH770","produce_consume": "BATCH770 BATCH940"}
PUT g_explore/_doc/1
{ "lot_num":"A2-0", "out_batch": "BATCH770","input_batch": "BATCH330","produce_consume": "BATCH770 BATCH330"}
PUT g_explore/_doc/2
{ "lot_num":"A2-2", "out_batch": "BATCH770","input_batch": "BATCH329","produce_consume": "BATCH329 BATCH770"}
PUT g_explore/_doc/3
{ "lot_num":"A3-1", "out_batch": "BATCH330","input_batch": "BATCH328","produce_consume": "BATCH328 BATCH330"}
Where out_batch is the current batch and input batch is the batch that created the lot, aka the parent batch. In other words:
Batch330 was used to make Batch328
Batch 328 & Batch329 were used to make Batch770
Batch 770 was used to make Batch940.
This is a simple example, but the idea holds. In practice it may be as many as 40 layers. I've been trying to do a graph api query to query for the most recent child lot (A1 in this case), and get the chain of all the batches.
I expect to get the links between all these batches, but I can only get one step at a time. I can not find any examples to do as the documents say " Connections can be nested inside the connections
object to explore additional relationships in the data. Each level of nesting is considered a hop , and proximity within the graph is often described in terms of hop depth ."
Here is my query:
POST g_explore/_graph/explore
{
"query": {
"terms" : {
"lot_num.keyword":["A1"]
}
},
"controls": {
"use_significance": false,
"sample_size": 5,
"timeout": 5000
},
"connections": {
"vertices": [
{
"field": "out_batch.keyword",
"size": 20,
"min_doc_count": 1
},
{
"field": "input_batch.keyword",
"size": 20,
"min_doc_count": 1
}
]
},
"vertices": [
{
"field": "lot_num.keyword",
"size": 20,
"min_doc_count": 1
}
]
}
Which gives:
{
"took": 0,
"timed_out": false,
"failures": [],
"vertices": [
{
"field": "lot_num.keyword",
"term": "A1",
"weight": 1,
"depth": 0
},
{
"field": "input_batch.keyword",
"term": "BATCH770",
"weight": 0.475,
"depth": 1
},
{
"field": "out_batch.keyword",
"term": "BATCH940",
"weight": 0.475,
"depth": 1
}
],
"connections": [
{
"source": 0,
"target": 1,
"weight": 0.475,
"doc_count": 1
},
{
"source": 0,
"target": 2,
"weight": 0.475,
"doc_count": 1
}
]
}
Great it got the first set of input-output batches, but how do I get the next hop?
Thank you in advance.