Class ContextMapping<T extends ToXContent>

    • Method Detail

      • name

        public java.lang.String name()
        Returns:
        the name/id of the context
      • parseContext

        protected abstract java.util.Set<java.lang.String> parseContext​(ParseContext.Document document)
        Retrieves a set of context from a document at index-time.
      • fromXContent

        protected abstract T fromXContent​(XContentParser context)
                                   throws java.io.IOException
        Prototype for the query context
        Throws:
        java.io.IOException
      • toInternalQueryContexts

        protected abstract java.util.List<ContextMapping.InternalQueryContext> toInternalQueryContexts​(java.util.List<T> queryContexts)
        Convert query contexts to common representation
      • toInnerXContent

        protected abstract XContentBuilder toInnerXContent​(XContentBuilder builder,
                                                           ToXContent.Params params)
                                                    throws java.io.IOException
        Implementations should add specific configurations that need to be persisted
        Throws:
        java.io.IOException
      • validateReferences

        protected void validateReferences​(Version indexVersionCreated,
                                          java.util.function.Function<java.lang.String,​MappedFieldType> fieldResolver)
        Checks if the current context is consistent with the rest of the fields. For example, the GeoContext should check that the field that it points to has the correct type.
      • validateContextPaths

        public static void validateContextPaths​(Version indexVersionCreated,
                                                java.util.List<FieldMapper> fieldMappers,
                                                java.util.function.Function<java.lang.String,​MappedFieldType> fieldResolver)
        Verifies that all field paths specified in contexts point to the fields with correct mappings
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object