Convert field to tag

influxdb
#1

Hello,

I wish ask you if there are any way to convert fields to tags on existing measurement with many points.

Regards
Ariel

#2

@acanepalumile You will need to rewrite the data. I would suggest trying a SELECT ... INTO query. Does that help?

#3

Hi @jackzampolin, thank you very much for your answer!

I have already used select … into, but the field that I need to convert to tag is still a field. Basically, I have a measurement with this fields:

SALA: tag
sector: field

and I need that the field “sector” convert to tag for use it as a filter in templating. This measurement has many points inside.

Please, can you give me further informtation about how does it works. How does the select into convert a field into tag?

Regards
Ariel

1 Like
#4

Be sure to use GROUP BY to identify the tags.

For example:

select * into B from A

all tags will be converted to fields.

select * into B from A group by T

and T will be a tag in B, not a field.

1 Like
#5

Hello Frank,

Thank you very much for your answer.

Regards
Ariel

1 Like
#6

I tried using this approach, but still my fields remain fields in the new measurement. Any ideas why?

select * into B from A group by T

My command:
select * into water_level from level group by location,level

#7

I have failed with select into. Now I’m out of ideas! Pissed off!

1 Like