Query Syntax for proximity searches

Can some one help me getting these query syntax for below queries

how to find documents that has united and states but not with in 30 words ?(united
AND states NOT WITHIN 30 WORDS)?

how to find the documents that has united before america ?(united BEFORE
america)

how to find the documents that has united followed by america?(united
FOLLOWEDBY america )

how to find the documents that war and peace near novel or book?(war AND
peace) NEAR (novel OR book)

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/9bbb528f-32ad-4fb9-9c6a-a5f116d5ac35%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hi ,

how to find documents that has united and states but not with in 30
words ?(united
AND states NOT WITHIN 30 WORDS)?
Use "united state"~30 in query string query or you can directly use slop in
phrase match query.

For second and the third , you need to use the above example with a high
slop value.

Last one , you need to expand that to query of above format.

You can find more information here -
http://www.elastic.co/guide/en/elasticsearch/reference/1.x/query-dsl-query-string-query.html

Thanks
Vineeth Mohan,
Elasticsearch consultant,
qbox.io ( Elasticsearch service provider http://qbox.io/)

On Wed, Apr 8, 2015 at 4:50 AM, bvnrwork budda08nitt@gmail.com wrote:

Can some one help me getting these query syntax for below queries

how to find documents that has united and states but not with in 30 words
?(united AND states NOT WITHIN 30 WORDS)?

how to find the documents that has united before america ?(united BEFORE
america)

how to find the documents that has united followed by america?(united
FOLLOWEDBY america )

how to find the documents that war and peace near novel or book?(war AND
peace) NEAR (novel OR book)

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/9bbb528f-32ad-4fb9-9c6a-a5f116d5ac35%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/9bbb528f-32ad-4fb9-9c6a-a5f116d5ac35%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAGdPd5n7WesXvrnebTOob2-um2THDDQTnLXEmAanUCwM%3DPiMYA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Thank you , can you clarify this , do we need to use not operator for
getting "united and states not with in 30 words "

I tested it works to get united and states with in 30 words but not for"
united and states not with in 30 words"

united AND states NOT WITHIN 30 WORDS

On Wednesday, 8 April 2015 00:35:35 UTC-4, vineeth mohan wrote:

Hi ,

how to find documents that has united and states but not with in 30 words
?(united AND states NOT WITHIN 30 WORDS)?
Use "united state"~30 in query string query or you can directly use slop
in phrase match query.

For second and the third , you need to use the above example with a high
slop value.

Last one , you need to expand that to query of above format.

You can find more information here -
http://www.elastic.co/guide/en/elasticsearch/reference/1.x/query-dsl-query-string-query.html

Thanks
Vineeth Mohan,
Elasticsearch consultant,
qbox.io ( Elasticsearch service provider http://qbox.io/)

On Wed, Apr 8, 2015 at 4:50 AM, bvnrwork <budda...@gmail.com <javascript:>

wrote:

Can some one help me getting these query syntax for below queries

how to find documents that has united and states but not with in 30 words
?(united AND states NOT WITHIN 30 WORDS)?

how to find the documents that has united before america ?(united BEFORE
america)

how to find the documents that has united followed by america?(united
FOLLOWEDBY america )

how to find the documents that war and peace near novel or book?(war AND
peace) NEAR (novel OR book)

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/9bbb528f-32ad-4fb9-9c6a-a5f116d5ac35%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/9bbb528f-32ad-4fb9-9c6a-a5f116d5ac35%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/5569730d-a90f-4ace-b5c9-d294165814db%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Actually I wrote the below queries , let me know if they are correct

  1. "United States" ~ 3 - to get documents with United States with in 30
    words
    2)"United States" NOT "United States" ~ 30 - to get documents which has
    united states not with in 30 words
    3)war AND peace ~ (novel OR book) - to get documents which has war and
    peace and near to the words novel or book
    4)china AND India ~ World to get documents which has both china and india
    and near to the word "World"

What I dont know is to specify the order of the words in the queries

how to write queries to get documents which has united followed by states

how to write queries to get documents which has china before India

On Wednesday, 8 April 2015 00:35:35 UTC-4, vineeth mohan wrote:

Hi ,

how to find documents that has united and states but not with in 30 words
?(united AND states NOT WITHIN 30 WORDS)?
Use "united state"~30 in query string query or you can directly use slop
in phrase match query.

For second and the third , you need to use the above example with a high
slop value.

Last one , you need to expand that to query of above format.

You can find more information here -
http://www.elastic.co/guide/en/elasticsearch/reference/1.x/query-dsl-query-string-query.html

Thanks
Vineeth Mohan,
Elasticsearch consultant,
qbox.io ( Elasticsearch service provider http://qbox.io/)

On Wed, Apr 8, 2015 at 4:50 AM, bvnrwork <budda...@gmail.com <javascript:>

wrote:

Can some one help me getting these query syntax for below queries

how to find documents that has united and states but not with in 30 words
?(united AND states NOT WITHIN 30 WORDS)?

how to find the documents that has united before america ?(united BEFORE
america)

how to find the documents that has united followed by america?(united
FOLLOWEDBY america )

how to find the documents that war and peace near novel or book?(war AND
peace) NEAR (novel OR book)

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/9bbb528f-32ad-4fb9-9c6a-a5f116d5ac35%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/9bbb528f-32ad-4fb9-9c6a-a5f116d5ac35%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/0e2a1e11-c453-4154-ab7e-44683c2781c3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

1 Like