Elasticsearch Field Preference for result sequence


(Suraj) #1

I have created the index in elasticsearch with the following mapping:

{
    "test": {
        "mappings": {
            "documents": {
                "properties": {
                    "fields": {
                        "type": "nested",
                        "properties": {
                            "uid": {
                                "type": "keyword"
                            },
                            "value": {
                                "type": "text",
                                "copy_to": [
                                    "fulltext"
                                ]
                            }
                        }
                    },
                    "fulltext": {
                        "type": "text"
                    },
                    "tags": {
                        "type": "text"
                    },
                    "title": {
                        "type": "text",
                        "fields": {
                            "raw": {
                                "type": "keyword"
                            }
                        }
                    },
                    "url": {
                        "type": "text",
                        "fields": {
                            "raw": {
                                "type": "keyword"
                            }
                        }
                    }
                }
            }
        }
    }
}

While searching I want to set the preference of fields for example if search text found in title or url then that document comes first then other documents.

Can we set a field preference for search result sequence(in my case preference like title,url, tags, fields)?


(system) #2

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