Back to All

How to prevent some attribute not be able to be searched in a workspace?

(edited)

This is actually not a question. I tried to figure out how to prevent some attribute not to be used in elastic search in a certain workspace. This is how my colleague Eetu Tarkamo figured it out. I was in the correct path and all he had to change in my faulty codeline was "attribute..keyword": "{{}}" to a correct value {{term}}...

{
    "bool": {
        "must_not": [{
                "term": {
                    "attribute.<propertyname>.keyword": "{{term}}"
                }
            }
        ],
        "must": {
            "query_string": {
                "query": "{{term}}",
                "default_operator": "AND",
                "fields": [
                    "key^6",
                    "name^4",
                    "_all"
                ]
            }
        },
        "filter": {
            "bool": {
                "must": [{
                        "bool": {
                            "should": [{
                                    "term": {
                                        "type": "<your type item>"
                                    }
                                }, {
                                    "term": {
                                        "type": "<your another type item>"
                                    }
                                }
                            ]
                        }
                    }, {
                        "bool": {
                            "should": [{
                                    "term": {
                                        "owner": "{{<item>.<itemvalue>}}"
                                    }
                                }, {
                                    "terms": {
                                        "attribute.<value>.keyword": "{{<item.propertyname>}}"
                                    }
                                }
                            ]
                        }
                    }
                ]
            }
        }
    }
}

Now the actual question... :D If i want to select just some fields to be able to be used in the elastic search in a certain workspace, I just replace that "_all", with typing all those wanted field names that I want to be enabled in the workspace search?