# SearchException: HSEARCH400609: Unknown field

**URL:** <https://discourse.hibernate.org/t/searchexception-hsearch400609-unknown-field/6113>\
**Category:** Hibernate Search\
**Created:** [March 3, 2022, 10:33am UTC](https://discourse.hibernate.org/t/searchexception-hsearch400609-unknown-field/6113 "2022-03-03T10:33:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Prashant\_Kamble](https://avatars.discourse-cdn.com/v4/letter/p/df705f/32.png) [@Prashant\_Kamble](https://discourse.hibernate.org/u/Prashant_Kamble)\
**Post date:** [March 3, 2022, 10:33am UTC](https://discourse.hibernate.org/t/searchexception-hsearch400609-unknown-field/6113/1 "2022-03-03T10:33:11Z")

</div>

I have below code in my spring-boot application . We are not getting any exception at startup but while creating attribute I am getting below exception like  
Caused by: org.hibernate.search.util.common.SearchException: HSEARCH400609: Unknown field ‘attributes.archetype.archetypeId’.

I am not sure if I miss anything else…

**Resource.java(Entity class)**

```auto
    @MapKeyColumn(name = "attribute_name")
    @Column(name = "attribute_value", nullable = false, length = 5000)
    @PropertyBinding(binder = @PropertyBinderRef(type = ResourceAttributesBinder.class))
    @Convert(attributeName = "value", converter = JSONObjectConverter.class)
    @EqualsAndHashCode.Exclude
    @ToString.Exclude
    @OptimisticLock(excluded = true)
    private Map<String, JSONObject> attributes;

```

```auto

```

**ResourceAttributesBinder.java**

```auto
public class ResourceAttributesBinder implements PropertyBinder {
    @Override
    public void bind(PropertyBindingContext context) {
        context.dependencies().useRootOnly();
        PojoModelProperty bridgedElement = context.bridgedElement();
        IndexSchemaObjectField attributeField = context.indexSchemaElement()
                .objectField( bridgedElement.name() );
        context.bridge(Map.class,new ResourceAttributesPropertyBridge(attributeField.toReference()));
    }
}

```

**ResourceAttributesPropertyBridge.java**

```auto
@Override
    public void write(DocumentElement target, Map bridgedElement, PropertyBridgeWriteContext context) {
        final Map<String, Object> indexMap = (Map<String, Object>) bridgedElement;
        DocumentElement indexedAttributeMetadata = target.addObject( fieldReference );
        ....        
        ....
        
        indexedAttributeMetadata.addValue(fieldName,attributeValue.toString());    
}
```

---

<div class="post-metadata">

**Author:** ![yrodiere](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/yrodiere/32/1760_2.png) [@yrodiere](https://discourse.hibernate.org/u/yrodiere)\
**Post date:** [March 3, 2022, 10:34am UTC](https://discourse.hibernate.org/t/searchexception-hsearch400609-unknown-field/6113/2 "2022-03-03T10:34:26Z")

</div>



---

<div class="post-metadata">

**Author:** ![yrodiere](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/yrodiere/32/1760_2.png) [@yrodiere](https://discourse.hibernate.org/u/yrodiere)\
**Post date:** [March 3, 2022, 10:35am UTC](https://discourse.hibernate.org/t/searchexception-hsearch400609-unknown-field/6113/3 "2022-03-03T10:35:45Z")

</div>

Please make some effort to:

- format your code properly (see [Discourse Text Formatting How-to! - Forum Tutorials - Episode Forums](https://forums.episodeinteractive.com/t/discourse-text-formatting-how-to/304))
- explain your problem
- include all necessary information (including the **full** stack traces if relevant).

Closing.
