# Why doesn't elser\_model\_1 generate the Vectors during index?

**URL:** <https://discuss.elastic.co/t/why-doesnt-elser-model-1-generate-the-vectors-during-index/345920>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-machine-learning\
**Created:** [October 27, 2023, 1:02pm UTC](https://discuss.elastic.co/t/why-doesnt-elser-model-1-generate-the-vectors-during-index/345920 "2023-10-27T13:02:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mbastarache](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mbastarache/32/126984_2.png) [@mbastarache](https://discuss.elastic.co/u/mbastarache)\
**Post date:** [October 27, 2023, 1:02pm UTC](https://discuss.elastic.co/t/why-doesnt-elser-model-1-generate-the-vectors-during-index/345920/1 "2023-10-27T13:02:49Z")

</div>

No matter what I try, I don't get any errors during indexing, but when I search, the ml\_title and ml\_description fields are not in the results. When I look at the mappings, they are there with the correct configurations.

I followed the primary documentation, and I also used [Using ELSER for multiple fields - #2 by wei.wang](https://discuss.elastic.co/t/using-elser-for-multiple-fields/341347/2) as a reference.

I confirmed the elser\_model\_1 has been installed, started and running.

I confirmed the pipeline exists

I confirmed when I index the doc, I pass the \_pipeline

Is there a log file, or anything that I could look for to see if there was an error ?

Here is a PHP sample of my index.

```auto
$params = [
	'index' => 'job_postings',
	'body' => [
		'mappings' => [
			'_source' => [
				'enabled' => true
			],
			'properties' => [
				'publish_id' => [
					'enabled' => false
				],
				'title' => [
					'type' => 'text',
					'index' => true
				],
				'ml_title.tokens' => [
					'type' => 'rank_features'
				],
				'description' => [
					'type' => 'text',
					'index' => true
				],
				'ml_description.tokens' => [
					'type' => 'rank_features'
				]
			]
		]
	]
]; 

try {
	$response = $client->indices()->create($params);
} catch(Exception $e) {
	$response = $e->getMessage();
}

```

Here is the pipeline I created

```auto
PUT _ingest/pipeline/job_postings-elser
{
  "on_failure": [
    {
      "set": {
        "description": "Record error information",
        "field": "error_information",
        "value": "Processor {{ _ingest.on_failure_processor_type }} with tag {{ _ingest.on_failure_processor_tag }} in pipeline {{ _ingest.on_failure_pipeline }} failed with message {{ _ingest.on_failure_message }}"
      }
    }
  ],
  "processors": [
    {
      "inference": {
        "model_id": ".elser_model_1",
        "target_field": "ml_title",
        "field_map" : {
          "title": "text_field"
        },
        "inference_config": {
          "text_expansion": {
            "results_field": "tokens"
          }
        }
      }
    },
    {
      "inference": {
        "model_id": ".elser_model_1",
        "target_field": "ml_description",
        "field_map": {
          "description": "text_field"
        },
        "inference_config": {
          "text_expansion": {
            "results_field": "tokens"
          }
        }
      }
    }
  ]
}

```

Then when I index the doc, here is the sample code.

```auto
$jData = [
	'publish_id' => '1234567890',
	'title' => 'Web Developer',
	'description' => 'You role in the company .....'
];

$params['body'][] = [
	'index' => [
		'_index' => 'job_postings',
		'_id' => '1234567890'
	],
	'_pipeline' => 'job_postings-elser'
];
$params['body'][] = $jData;

try {
	$response = $client->bulk($params);
} catch(Exception $e) {
	$response = $e->getMessage();
}

```

After this completes with no errors, I go to Kibana and run

`GET job_postings/_search`

The docs are there in the results, but ml\_title and ml\_description fields are no wheres in the search results.

Or does it just take a long, long time to process? If that is the case, how do I know a document is being processed and when it will be complete?

---

<div class="post-metadata">

**Author:** ![mbastarache](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mbastarache/32/126984_2.png) [@mbastarache](https://discuss.elastic.co/u/mbastarache)\
**Post date:** [October 27, 2023, 1:18pm UTC](https://discuss.elastic.co/t/why-doesnt-elser-model-1-generate-the-vectors-during-index/345920/5 "2023-10-27T13:18:07Z")

</div>

![Screenshot 2023-10-27 at 10.17.14 AM](https://us1.discourse-cdn.com/elastic/original/3X/5/b/5b1b6254e8b005eb25adbaafe7fa3a88e5da8f00.png)

---

<div class="post-metadata">

**Author:** ![mbastarache](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mbastarache/32/126984_2.png) [@mbastarache](https://discuss.elastic.co/u/mbastarache)\
**Post date:** [October 27, 2023, 3:02pm UTC](https://discuss.elastic.co/t/why-doesnt-elser-model-1-generate-the-vectors-during-index/345920/6 "2023-10-27T15:02:49Z")

</div>

It took a while but I finally did get my fields back from the leaning model. Can someone tell me if there is a way to monitor what the pipeline is processing so we can gauge is there is bottle necks, errors or time to complete?

---

<div class="post-metadata">

**Author:** ![wei.wang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wei.wang/32/51803_2.png) [@wei.wang](https://discuss.elastic.co/u/wei.wang)\
**Post date:** [October 27, 2023, 8:29pm UTC](https://discuss.elastic.co/t/why-doesnt-elser-model-1-generate-the-vectors-during-index/345920/7 "2023-10-27T20:29:46Z")

</div>

Hi Mike,

[This API](https://www.elastic.co/guide/en/elasticsearch/reference/current/get-trained-models-stats.html) can be used to retrieve model usage information: `GET _ml/trained_models/.elser_model_1/_stats` . Or, through UI, in your attached picture, click "\>" to expand, you will see model & pipeline details information.

I don't know much about PHP, however, you might consider using batches (size: 50 or 100) : [using **Bulk indexing with batches**](https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/indexing_documents.html), which should help for your case.

Regards.

---

<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:** [November 24, 2023, 8:30pm UTC](https://discuss.elastic.co/t/why-doesnt-elser-model-1-generate-the-vectors-during-index/345920/8 "2023-11-24T20:30:42Z")

</div>

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