# Scoring issue with copy\_to

**URL:** <https://discuss.elastic.co/t/scoring-issue-with-copy-to/312472>\
**Category:** Elasticsearch\
**Created:** [August 19, 2022, 2:06pm UTC](https://discuss.elastic.co/t/scoring-issue-with-copy-to/312472 "2022-08-19T14:06:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lucie-wartelle](https://avatars.discourse-cdn.com/v4/letter/l/90ced4/32.png) [@lucie-wartelle](https://discuss.elastic.co/u/lucie-wartelle)\
**Post date:** [August 19, 2022, 2:06pm UTC](https://discuss.elastic.co/t/scoring-issue-with-copy-to/312472/1 "2022-08-19T14:06:40Z")

</div>

Hello !

I'm facing an issue with elasticsearch 8. I have an index that contains companies and I use a copy\_to parameters to group searchable fields of these companies. However, some fields can be null, and some can contains strings with spaces. As a result, one company doesn't have the same search field length than another one and it influences search results. For example:

```auto
PUT /my-index
{
	mappings: {
		properties: {
			"companyName": {
				"type": "text",
				"store": true,
				"copy_to": "search_field_1"
			},
			"reference": {
				"type": "text",
				"store": true,
				"copy_to": "search_field_1"
			}
			"comment": {
				"type": "text",
				"store": true,
				"copy_to": "search_field_1"
			},
			"otherField": {
				"type": "text",
				"store": true,
				"copy_to": "search_field_2"
			}
		}
	}
}

POST my-index/_doc/
{
	"companyName": "test",
	"reference": "001245",
	"comment": "a large comment",
	"otherField": "00000"
}
POST my-index/_doc/
{
	"companyName": "test company",
	"reference": "123",
	"comment": null,
	"otherField": null
}

GET /_search
{
  "query": {
    "multi_match" : {
      "query": "test", 
      "type": "cross_fields",
      "operator": "and",
      "fields": ["search_field_1^1", "search_field_2^2"] 
    }
  }
}

```

If I search "test", I am expecting the first company as the first result because of its company name. Instead of that, it's the second one, because its search field length is shorter.

Did I miss something here? Should I change my mapping to archive that behavior?

---

<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:** [September 16, 2022, 2:07pm UTC](https://discuss.elastic.co/t/scoring-issue-with-copy-to/312472/2 "2022-09-16T14:07:11Z")

</div>

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