# Looking for suggestions on different types of queries

**URL:** <https://discuss.elastic.co/t/looking-for-suggestions-on-different-types-of-queries/89264>\
**Category:** Elasticsearch\
**Created:** [June 13, 2017, 8:31pm UTC](https://discuss.elastic.co/t/looking-for-suggestions-on-different-types-of-queries/89264 "2017-06-13T20:31:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pravekal](https://avatars.discourse-cdn.com/v4/letter/p/e274bd/32.png) [@pravekal](https://discuss.elastic.co/u/pravekal)\
**Post date:** [June 13, 2017, 8:31pm UTC](https://discuss.elastic.co/t/looking-for-suggestions-on-different-types-of-queries/89264/1 "2017-06-13T20:31:15Z")

</div>

Hi,

We have to support combination of following type queries

. Bool Queries  
· Span Queries  
· Phrase search  
· Wildcard query  
· Fuzzy Query  
· Boost Query  
· Range Query  
· Fielded search  
· Joining Queries

Operator order precedence  
· Parenthesis, i.e, ( )  
· ADJ, NEAR, ONEAR  
· WITH  
· SAME  
· AND, NOT  
· XOR  
· OR

--The **NEAR** operator searches for terms that are next to each other( distance=0)  
--The **ADJ/ONNEAR** operator is similar to the NEAR operator, except it requires matching documents have terms in the same order as specified in the expression  
--WITH Operator will search for terms within a distance of 15.  
--SAME Operator for the terms within a distance of 200.  
--'$' will be interpreted as any number of characters and hence will be converted to '\*’ WILDCARD query  
-- '$n' will be interpreted as 'n' number of characters and will be converted to REGEX query  
-- '~' if used in search text will always have a number following the '~' and will be interpreted as 'FUZZY' of the preceding string with a similarity of the following number.  
Ex: iphone ~4 will become FUZZY(iphone, similarity=4)  
-- '^' if used in search text will always have a number following '^' and this number will be used as 'BOOST' value for the string preceding '^'.  
Ex: iphone^100 will become TERM(iphone, BOOST=100)

# Example User Queries

1. split$4 with (term1 or term2 adj term adj term$3) with (term4 or term5 adj term6 adj term7 or term8$4)

2. ((term1 or term2 or term3) near2 (term4 or term5 or (term6$4 near3 term7) or term8$4)) and ((term9 or term10 or term11) near (term11$5 or (term12 adj term13$5) or term14$4 or term15$5))

We were able to achieve all the combinations using SPAN query but SPAN NOT is not working for NOT queries

Any suggestions ?

---

<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:** [July 11, 2017, 8:31pm UTC](https://discuss.elastic.co/t/looking-for-suggestions-on-different-types-of-queries/89264/2 "2017-07-11T20:31:43Z")

</div>

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