Indexing an array in issue entity properties is broken on jira 8

With Jira 7 we indexed references to issues in the following way:

{id: [1, 2, 3]}

in issue properties. And we then had a indexing configuration like this:

    <index-document-configuration entity-key="IssueProperty" key="atlas-crm-issue-entity-property">
        <key property-key="atlas_crm_entity">
            <extract path="id" type="number" alias="atlasReference"/>
        </key>
    </index-document-configuration>

We are coming from cloud and there this way of indexing arrays also works. But when we started testing on Jira 8 we noticed the following exception:

2019-03-14 12:37:35,513 http-nio-8080-exec-4 WARN admin 757x8030x1 vnxrua 95.97.91.91,10.0.150.186 /plugins/servlet/atlas-crm/api [c.a.jira.index.AccumulatingResultBuilder] DocValuesField "ISSUEPROP_atlas_crm_entity$id" appears more than once in this document (only one value is allowed per field)                     
java.lang.IllegalArgumentException: DocValuesField "ISSUEPROP_atlas_crm_entity$id" appears more than once in this document (only one value is allowed per field)                                                                                                                                                              
        at org.apache.lucene.index.SortedDocValuesWriter.addValue(SortedDocValuesWriter.java:67)                                                                                                                                                                                                                              
        at org.apache.lucene.index.DefaultIndexingChain.indexDocValue(DefaultIndexingChain.java:550)                                                                                                                                                                                                                          
        at org.apache.lucene.index.DefaultIndexingChain.processField(DefaultIndexingChain.java:466)                                                                                                                                                                                                                           
        at org.apache.lucene.index.DefaultIndexingChain.processDocument(DefaultIndexingChain.java:392)                                                                                                                                                                                                                        
        at org.apache.lucene.index.DocumentsWriterPerThread.updateDocument(DocumentsWriterPerThread.java:240)                                                                                                                                                                                                                 
        at org.apache.lucene.index.DocumentsWriter.updateDocument(DocumentsWriter.java:497)                                                                                                                                                                                                                                   
        at org.apache.lucene.index.IndexWriter.updateDocument(IndexWriter.java:1729)                                                                                                                                                                                                                                          
        at com.atlassian.jira.index.WriterWrapper.updateDocuments(WriterWrapper.java:85)                                                                                                                                                                                                                                      
        at com.atlassian.jira.index.Operations$Update.perform(Operations.java:169)                                                                                                                                                                                                                                            
        at com.atlassian.jira.index.Operations$Completion.perform(Operations.java:267)                                                                                                                                                                                                                                        
        at com.atlassian.jira.index.QueueingIndex$CompositeOperation.perform(QueueingIndex.java:187)                                                                                                                                                                                                                          
        at com.atlassian.jira.index.DefaultIndexEngine$FlushPolicy.perform(DefaultIndexEngine.java:76)                                                                                                                                                                                                                        
        at com.atlassian.jira.index.DefaultIndexEngine.write(DefaultIndexEngine.java:138)                                                                                                                                                                                                                                     
        at com.atlassian.jira.index.DefaultIndex.perform(DefaultIndex.java:28)                                                                                                                                                                                                                                                
        at com.atlassian.jira.index.QueueingIndex$Task.perform(QueueingIndex.java:132)                                                                                                                                                                                                                                        
        at com.atlassian.jira.index.QueueingIndex$Task.index(QueueingIndex.java:144)                                                                                                                                                                                                                                          
        at com.atlassian.jira.index.QueueingIndex$Task.run(QueueingIndex.java:111)                                                                                                                                                                                                                                            
        at java.lang.Thread.run(Thread.java:748)     

Any ideas how we could solve this issue? I am not sure if this is a bug (but it worked with Jira 7) or if we should do this another way (which would suck because this would make it harder for our users to migrate between jira-server and jira-cloud…

3 Likes

You’re probably not going to like this but Atlassian doesn’t support array types on Issue Properties.

1 Like

You are right I dont like this :joy:

This has been supported on Cloud for more than 2 years now. That is why we thought it would work the same on server. But we actually managed to fix it by saving it in a string like this: "1 2 3" and then index as text. It wil tokenize it on the spaces and then you can actually search on the exact numbers.

3 Likes

Sorry and good luck :frowning: That’s a super nifty solution though. Thanks for the follow up.

1 Like

@m.kuijpers I am running into the same issue but I have not seen anywhere stated that arrays are not supported on Jira Server.

The documentation on entity properties for Jira Cloud and Jira Server (if arrays are supported) is super confusing (for reasons given here) and I have reported it to Atlassian already a couple of times.

I am still not sure if this is not a bug because like @m.kuijpers said this has been working on Jira Server so far…

https://developer.atlassian.com/server/jira/platform/index-document-configuration/

Currently, specifying indexes for JSON arrays is not supported.

2 Likes

This seems to be a regression since this was working in Jira 7, but not 8. Consequently, I have created JRASERVER-72078 for the Jira Server team to address.

3 Likes