[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Advertisement | Home]

Elasticsearch

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 8
Thread images: 4

File: elastic.png (4KB, 384x131px) Image search: [Google]
elastic.png
4KB, 384x131px
Is anyone here really good with elasticsearch? The docs are so dense, I don't know where to begin. I want to search for entities ranked on degree of overlap of their tags, i.e. if I store a bunch of documents with tags 1:{X,Y,Z}, 2:{A,B,C}, 3:{Z} and I query with {X,Z}, I get 1,3,2 in order. What api should I use? Also, I'm wondering if it's able to handle tag autocompletion, or should I roll my own?
>>
File: Yotsubato_v04_094.jpg (55KB, 831x1200px)
Yotsubato_v04_094.jpg
55KB, 831x1200px
>>60127909
If i understand correct then you need to make an aggregation of the count of the tags field.

You would get something like this.

Count of z: 23, x:2, y:0
>>
>>60127909
>>60128903
Just got home.

Here is a query that will do what i wrote.

{
"size": 0,
"query": {
"bool": {
"must": [
{
"query_string": {
"query": "Z",
"analyze_wildcard": true
}
},
{
"range": {
"@timestamp": {
"gte": 1493470976809,
"lte": 1493485376809,
"format": "epoch_millis"
}
}
}
],
"must_not": []
}
},
"_source": {
"excludes": []
},
"aggs": {
"2": {
"terms": {
"field": "tags.raw",
"size": 10,
"order": {
"_count": "desc"
}
}
}
}
}
>>
File: uisuki_hibiki.png (584KB, 500x712px) Image search: [Google]
uisuki_hibiki.png
584KB, 500x712px
>>60129215
This is time based but just remove it or only take the "aggs"

Pro tip: Install Kibana and use it to do the aggs you want, it can show you the query it made and you can copy that to your program.
>>
do you fags use elasticsearch as a general purpose db or just to store and process logs ?
>>
>>60129408
Guess general purpose.

Use it for device syslogs and for performance, div metrics etc, anything where we can use the different aggs.
>>
>>60128903
>>60129215
thanks for that... will take me a bit to understand, but it gives me a clue which parts of the rather huge api to focus on
>>
>>60129408
i'm making a marketplace using postgres as primary db and elasticsearch for matching buyers and sellers appropriately.
Thread posts: 8
Thread images: 4


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

If you need a post removed click on it's [Report] button and follow the instruction.
If you like this website please support us by donating with Bitcoin at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties. Posts and uploaded images are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that website. If you need information about a Poster - contact 4chan. This project is not affiliated in any way with 4chan.