Can we limit number of unique values per fields?

The company i work for has had some query regarding this matter. They want to check if elasticsearch is capable of limiting the number of unique values allowed in a field.

EX: the fields "source_ip" may only have three unique values, say, 192.168.0.1, 192.168.0.2 and 192.168.0.3.

I searched through the elasitcsearch documentation whether the indices settings, or field mapping supports this, but i could find such possibility.

Is there any way this can be done ?

Welcome to our community! :smiley:

No there's not, you'd need to do it during ingestion. You could use an ingest node for it, assuming you don't even want the data - https://www.elastic.co/guide/en/elasticsearch/reference/current/drop-processor.html

Thanks mate, I have not looked into injection. I will check if this solves our need.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.