Tags should support multiple values
A tag should support multiple values delivered as a json array
specifically for variant tracking in our case
thoughts??
I suspect we can address your needs with multiple tags on the series rather than one tag with multiple values. Can you give a little more detail on the use case?
Sure - so as an example we get a variable number of "audiences" whenever we purchase an ad impression as well as "contexts" - we ideally want to be able to use individual audiences/contexts as a tags for criteria but hey are 100% variable in terms of order quantity etc Happy to go in even further if needed Jon
@jglanz I can see why an array would be useful for that use case, but it's a significant change to the behavior of the tags. I don't expect it to be a near-term feature.
Meanwhile I think you could address your needs by using strings with separators. If you store each audience and context as something like "audience": "18-35;female;hispanic" and "context": "mobile;iOS 7;Safari;/news/breaking/2015/5/28/senate.html" then you can just use regex in your queries to pull out the relevant data.
For example, SELECT * FROM <measurement_name> WHERE audience =~ /.*;female;.*/ AND context =~ /.*;\/news\/breaking.*/ would return all points where the audience included female and the context included /news/breaking
One thing to note, tag keys and values can be strings with a max length of 64k. I doubt any of your concatenated strings would approach that size, but just in case.
That's actually pretty a perfect - I didn't realize we could refer tags
I guess arrays could show up in 1.1 ;)
This works great for filtering the data (although I'm not sure if it will perform well with a huge amount of points). But what if I want to group by one of the tags, say "audience"? Is there a way to do that with Influx v0.13?
@deluan https://docs.influxdata.com/influxdb/v0.13/query_language/data_exploration/#group-by-tag-values
You cannot use regex in a GROUP BY, so if you are referring to the idea of storing an array as a string and then GROUPing by only a portion of that string, that is not possible.
@beckettsean Yeah, that's what I was referring to. Are multi-valued tags something that you plan to support? If not, any suggestions on how to achieve that?
I don't see multi-valued tags being on the roadmap any time soon.
If you want to GROUP BY a tag, you must group by the entire value. You don't have to have every tag on every point, however, so simply store the values as individual tags.
I don't see why the array wouldn't be decomposable into key-value pairs, but perhaps if you want to share your sample data with [email protected] you might get some pointers.
For example, SELECT * FROM <measurement_name> WHERE audience =~ /.;female;./ AND context =~ /.;/news/breaking./ would return all points where the audience included female and the context included /news/breaking
@beckettsean I think this method may cause performance issue if there are a lot of tag values? Because the index cannot be used. Is there a work-around to do this?
is this still something to be considered? afaik influx already uses an inverted index of series key components (measurement, tags, field key). from my experience with inverted indexes is that they generally allow multivalued entries? if that is the case, then the changes to the storage engine should be minimal and the majority of required changes would be in the API layers.
for everyone that needs a solution now: you can "flip" tag keys and values, if you need multivalued tags as filters and not group constraints.
points,scopes=_1_2_3_ value=1 -> points,scope_1=scope,scope_2=scope,scope_3=scope value=1