How to get extra params with completion suggester?

Hello,

I set a parameter as "completion" type and when i query by completion suggester,i want the result contains others parameter‘s value。

for example, the index mapping as followed:

PUT music
{
    "mappings": {
        "properties" : {
            "suggest" : {
                "type" : "completion"
            },
            "title" : {
                "type": "keyword"
            },
            "date":{
               "type": "date"
           }
        }
    }
}

add data to this index

PUT music/_doc/1?refresh
{
    "suggest" : {
        "input": [ "Nevermind", "Nirvana" ],
        "weight" : 34
    }
}

query

POST music/_search
{
    "_source": "suggest", 
    "suggest": {
        "song-suggest" : {
            "prefix" : "nir",
            "completion" : {
                "field" : "suggest", 
                "size" : 5 
            }
        }
    }
}

and get the result

{
    "took": 6,
    "timed_out": false,
    "_shards" : {
        "total" : 1,
        "successful" : 1,
        "skipped" : 0,
        "failed" : 0
    },
    "hits": {
        "total" : {
            "value": 0,
            "relation": "eq"
        },
        "max_score" : null,
        "hits" : []
    },
    "suggest": {
        "song-suggest" : [ {
            "text" : "nir",
            "offset" : 0,
            "length" : 3,
            "options" : [ {
                "text" : "Nirvana",
                "_index": "music",
                "_type": "_doc",
                "_id": "1",
                "_score": 1.0,
                "_source": {
                    "suggest": ["Nevermind", "Nirvana"]
                }
            } ]
        } ]
    }
}

but i want the result also contains title's value , what should i do?

thanks

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