Hi Mark.
Thank you for the answer.
I have looked at your video and read more about significant terms, but I can't seem to get it to work.
Can you take a look at my queries and maybe come with a suggestion on how to improve it? I have posted the queries further down - also they are the old queries because I couldn't get what I tried not to crash.
For the Entity-centric part:
So what you are saying is, that I should index the data, so I have one user with the product the user have looked at in one doc?
Queries
This is the first request I make to the api, getting what people have looked at. The Term variable is the productid.
var response = lowlevelClient.XpackGraphExplore("{INDEX HERE}", @"
{
""query"": {
""query_string"": {
""query"": " + Term + @"
}
},
""controls"": {
""use_significance"": true,
""sample_size"": 1000,
""timeout"": 50000
},
""connections"": {
""query"": {
""bool"": {
""filter"": [
{
""range"": {
""timestamp"": {
""gte"": ""2016-02-25"",
""lt"": ""2017-03-25""
}
}
}
]
}
},
""vertices"": [
{
""field"": ""ipaddress.keyword"",
""size"": 35,
""min_doc_count"": 1
},
{
""field"": ""productid"",
""size"": 35,
""min_doc_count"": 1
}
]
},
""vertices"": [
{
""field"": ""ipaddress.keyword"",
""size"": 35,
""min_doc_count"": 1
},
{
""field"": ""productid"",
""size"": 35,
""min_doc_count"": 1
}
]
}
");
Then what I got of response from the last request, I loop through to get sales from the ips.
var ipsales = lowlevelClient.XpackGraphExplore("INDEX HERE", @"
{
""query"": {
""query_string"": {
""query"": """ + result.Ipaddress + @"""
}
},
""controls"": {
""use_significance"": false,
""sample_size"": 1000,
""timeout"": 50000
},
""connections"": {
""query"": {
""bool"": {
""filter"": [
{
""range"": {
""orderdate"": {
""gte"": ""2016-02-25"",
""lt"": ""2017-03-25""
}
}
}
]
}
},
""vertices"": [
{
""field"": ""salesorderid"",
""size"": 35,
""min_doc_count"": 1
},
{
""field"": ""ipaddress.keyword"",
""size"": 1,
""min_doc_count"": 2
},
{
""field"": ""productid"",
""size"": 35,
""min_doc_count"": 1
}
]
},
""vertices"": [
{
""field"": ""salesorderid"",
""size"": 35,
""min_doc_count"": 5
},
{
""field"": ""ipaddress.keyword"",
""size"": 1,
""min_doc_count"": 5
},
{
""field"": ""productid"",
""size"": 35,
""min_doc_count"": 5
}
]
}");
Hope you can help.
Regards Malthe