# Elasticsearch Field Preference for result sequence

**URL:** <https://discuss.elastic.co/t/elasticsearch-field-preference-for-result-sequence/131051>\
**Category:** Elasticsearch\
**Created:** [May 8, 2018, 7:13pm UTC](https://discuss.elastic.co/t/elasticsearch-field-preference-for-result-sequence/131051 "2018-05-08T19:13:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![surajdalvi](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@surajdalvi](https://discuss.elastic.co/u/surajdalvi)\
**Post date:** [May 8, 2018, 7:13pm UTC](https://discuss.elastic.co/t/elasticsearch-field-preference-for-result-sequence/131051/1 "2018-05-08T19:13:19Z")

</div>

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)?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 5, 2018, 7:13pm UTC](https://discuss.elastic.co/t/elasticsearch-field-preference-for-result-sequence/131051/2 "2018-06-05T19:13:21Z")

</div>

Closed on June 5, 2018, 7:13pm UTC

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