# Help Exposing ICUCollationDocValuesField

**URL:** <https://discuss.elastic.co/t/help-exposing-icucollationdocvaluesfield/76082>\
**Category:** Elasticsearch\
**Created:** [February 22, 2017, 4:49pm UTC](https://discuss.elastic.co/t/help-exposing-icucollationdocvaluesfield/76082 "2017-02-22T16:49:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mattweber](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mattweber/32/44940_2.png) [@mattweber](https://discuss.elastic.co/u/mattweber)\
**Post date:** [February 22, 2017, 4:49pm UTC](https://discuss.elastic.co/t/help-exposing-icucollationdocvaluesfield/76082/1 "2017-02-22T16:49:19Z")

</div>

I am in the process of writing a PR to expose `ICUCollationDocValuesField` as  
a custom `FieldMapper` in the `analysis-icu` plugin. I have never really worked  
with FieldMappers before and have a few questions:

1. `ICUCollationDocValuesField` says "you should not create a new one for each  
document, instead just make one and reuse it during your indexing process". In  
the context of elasticsearch, does this mean I would do something like [BinaryFieldMapper](https://github.com/elastic/elasticsearch/blob/master/core/src/main/java/org/elasticsearch/index/mapper/BinaryFieldMapper.java#L161)  
where its stored in the doc context? That appears to be per-doc, which would  
not be correct.

2. Should I just use a `BinaryFieldType` or write a custom one? I am thinking  
something along the lines of:

```java
    public static class Defaults {
          public static final MappedFieldType FIELD_TYPE = new BinaryFieldMapper.BinaryFieldType();
          static {
              FIELD_TYPE.setStored(false);
              FIELD_TYPE.setTokenized(false);
              FIELD_TYPE.setIndexOptions(IndexOptions.NONE);
              FIELD_TYPE.setHasDocValues(true);
              FIELD_TYPE.setDocValuesType(DocValuesType.SORTED);
              FIELD_TYPE.freeze();
          }
      }

```

1. Anything else I need to consider?

Thanks,  
Matt Weber

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 22, 2017, 4:49pm UTC](https://discuss.elastic.co/t/help-exposing-icucollationdocvaluesfield/76082/2 "2017-03-22T16:49:39Z")

</div>

Closed on March 22, 2017, 4:49pm UTC

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