# Can i use ELSER and OpenAI Embeddings together in Elasticsearch?

**URL:** <https://discuss.elastic.co/t/can-i-use-elser-and-openai-embeddings-together-in-elasticsearch/356512>\
**Category:** Elasticsearch\
**Tags:** vector-search\
**Created:** [April 1, 2024, 3:10am UTC](https://discuss.elastic.co/t/can-i-use-elser-and-openai-embeddings-together-in-elasticsearch/356512 "2024-04-01T03:10:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![shakunvohra](https://avatars.discourse-cdn.com/v4/letter/s/4af34b/32.png) [@shakunvohra](https://discuss.elastic.co/u/shakunvohra)\
**Post date:** [April 1, 2024, 3:10am UTC](https://discuss.elastic.co/t/can-i-use-elser-and-openai-embeddings-together-in-elasticsearch/356512/1 "2024-04-01T03:10:04Z")

</div>

I was wondering if I can use ELSER Vectors and OpenAI Embeddings together in same mapping for a better RAG results. The thought behind this is -  
take top 3 results from ELSER and take top 3 from OpenAI embeddings and combine them to send it to a llm for response.

{  
"testing": {  
"mappings": {  
"properties": {  
"embedding": {  
"type": "dense\_vector",  
"index": true,  
"similarity": "cosine"  
},  
"metadata": {  
"properties": {  
"chunk\_id": {  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword",  
"ignore\_above": 256  
}  
}  
},  
"id": {  
"type": "long"  
},  
"title": {  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword",  
"ignore\_above": 256  
}  
}  
}  
}  
},  
"text": {  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword",  
"ignore\_above": 256  
}  
}  
},  
"vector": {  
"properties": {  
"is\_truncated": {  
"type": "boolean"  
},  
"model\_id": {  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword",  
"ignore\_above": 256  
}  
}  
},  
"tokens": {  
"type": "rank\_features"  
}  
}  
}  
}  
}  
}  
}

When i index, i get this - elasticsearch.BadRequestError: BadRequestError(400, 'document\_parsing\_exception', '[1:5223] failed to parse: [rank\_features] fields do not support indexing multiple values for the same rank feature [vector.tokens.pr] in the same document')

---

<div class="post-metadata">

**Author:** ![Kathleen\_DeRusso](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kathleen_derusso/32/132039_2.png) [@Kathleen\_DeRusso](https://discuss.elastic.co/u/Kathleen_DeRusso)\
**Post date:** [April 1, 2024, 1:17pm UTC](https://discuss.elastic.co/t/can-i-use-elser-and-openai-embeddings-together-in-elasticsearch/356512/2 "2024-04-01T13:17:40Z")

</div>

Hey, have you tried using a nested field for your `rank_features` field? It's possible that you're trying to chunk your documents and index the same feature dimension twice. Check out this [search labs blog](https://www.elastic.co/search-labs/blog/chunking-via-ingest-pipelines) for more examples on this.

Also, helpful note - you can use Markdown syntax to format your code so it's more readable if you need help!

Good luck!

---

<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:** [April 29, 2024, 1:18pm UTC](https://discuss.elastic.co/t/can-i-use-elser-and-openai-embeddings-together-in-elasticsearch/356512/3 "2024-04-29T13:18:22Z")

</div>

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