# Translate query from Sphinx to Elasticsearch

**URL:** <https://discuss.elastic.co/t/translate-query-from-sphinx-to-elasticsearch/212005>\
**Category:** Elasticsearch\
**Created:** [December 16, 2019, 12:40pm UTC](https://discuss.elastic.co/t/translate-query-from-sphinx-to-elasticsearch/212005 "2019-12-16T12:40:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![zeusfsx](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zeusfsx/32/59433_2.png) [@zeusfsx](https://discuss.elastic.co/u/zeusfsx)\
**Post date:** [December 16, 2019, 12:40pm UTC](https://discuss.elastic.co/t/translate-query-from-sphinx-to-elasticsearch/212005/1 "2019-12-16T12:40:20Z")

</div>

I work with a monitoring system and have a lot of queries on Sphinx.

I need to translate Sphinx queries into elasticsearch, because we will upgrade our db on elasticsearch.

For example i have query on sphinx: `(Donald NEAR/3 Trump +Ukraine)| ((John NEAR/2 Biden) NEAR/5 Burisma)`

Does anyone know how to parse the sphinx query and translate it to elasticsearch?

---

<div class="post-metadata">

**Author:** ![Mikhail\_Khludnev](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mikhail_khludnev/32/59591_2.png) [@Mikhail\_Khludnev](https://discuss.elastic.co/u/Mikhail_Khludnev)\
**Post date:** [December 16, 2019, 1:13pm UTC](https://discuss.elastic.co/t/translate-query-from-sphinx-to-elasticsearch/212005/2 "2019-12-16T13:13:45Z")

</div>

Hello, Alexander.

`NEAR/num` is a slop in a phase [https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query-phrase.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query-phrase.html)  
Usually clauses are combined with `"bool"`. Low level positional queries are `spans` and `intervals`.

---

<div class="post-metadata">

**Author:** ![zeusfsx](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zeusfsx/32/59433_2.png) [@zeusfsx](https://discuss.elastic.co/u/zeusfsx)\
**Post date:** [December 19, 2019, 6:11pm UTC](https://discuss.elastic.co/t/translate-query-from-sphinx-to-elasticsearch/212005/3 "2019-12-19T18:11:28Z")

</div>

Can you give me some examples, for those queries?

---

<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:** [January 16, 2020, 6:11pm UTC](https://discuss.elastic.co/t/translate-query-from-sphinx-to-elasticsearch/212005/4 "2020-01-16T18:11:32Z")

</div>

Closed on January 16, 2020, 6:11pm UTC

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