2

I am indexing data from MongoDB that roughly looks like

{
    "name": "John Doe",
    "age": "25",
    "education": [
        {
            "title": "Masters",
            "status": 53,
            "finalProject": {
                "title": "Integrating Advanced STJs using KKO",
                "status": "In Progress"
            }
        },
        {
            "title": "Software Engineering",
            "status": 52,
            "finalProject": {
                "title": "Use of LPI in Multi-sanctioned BPDs",
                "status": "Completed"
            }
        },
        {
            "title": "Pre-Engineering",
            "status": 51
        },
        {
            "title": "Matriculation",
            "status": 52
        }
    ]
}

Notice that I have got two status fields; one at education.*.status which is integer and the other at education.*.finalProject.status. How can I specify copyFields for both?

I considered specifying them as follows in my schema

<field name="projectStatus" type="string" stored="true" indexed="true" multiValued="true"/>
<copyField source="*.finalProject.status" dest="projectStatus"/>

<field name="educationStatus" type="int" stored="true" indexed="true" multiValued="true"/>
<copyField source="*.status" dest="educationStatus"/>

but both the patterns seem to be conflicting as *.status already covers *.finalProject.status. How can I specify them both in separate copy fields?

Kamran Ahmed
  • 11,809
  • 23
  • 69
  • 101
  • Do you really need to wildcard those paths? What are the different versions of the field names you're trying to match? – MatsLindh Jul 16 '17 at 14:52
  • Yes because the number of `education` items is variable and can be different; otherwise I could do `education.0.status`, `education.1.status` etc. What other way is there than wildcarding? – Kamran Ahmed Jul 16 '17 at 14:59

0 Answers0