elasticsearch copy_to作为文本属性

时间:2017-02-17 10:09:14

标签: elasticsearch

我想在一个字段中组合几个属性。

    "mappings": {
        "my_type": {
            "transform": {
                "script": "ctx._source['combined'] = ctx._source['prop1'] + ' ' + ctx._source['prop2.prop2internal'] + ' ' + ctx._source['prop3']"
            },
            "properties": {
                "prop1": {
                    "type": "text",
                    "copy_to" : "combined"
                },
                "prop2": {
                    "type": "object",
                    "properties" : {
                        "prop2internal" : {
                            "type" : "text",
                            "copy_to" : "combined"
                        }
                    }
                },
                "prop3": {
                    "type": "keyword",
                    "copy_to" : "combined"
                },
                "combined"  : {
                    "type" : "text",
                    "store" : "yes"
                }
            }
        }
    }          

POST:

POST /my_index/my_type 
{
    "prop1": 'w A',
    "prop2": [prop2internal : 'x B'],
    "prop3": ['y C', 'z D']
}   

现在我的组合字段有['w A','x B','y C','z D']。我希望在其中搜索任何值的组合。例如:'w z C'必须匹配。 我试图将这些道具编写为连接字符串,但我的脚本抛出错误

 reason: 'Failed to parse mapping [my_type]: Root mapping definition has unsupported parameters:  

0 个答案:

没有答案