# How to query string for (contains this, also contains that, but shouldnt include these words)

**URL:** <https://discuss.elastic.co/t/how-to-query-string-for-contains-this-also-contains-that-but-shouldnt-include-these-words/119677>\
**Category:** Elasticsearch\
**Created:** [February 13, 2018, 4:42pm UTC](https://discuss.elastic.co/t/how-to-query-string-for-contains-this-also-contains-that-but-shouldnt-include-these-words/119677 "2018-02-13T16:42:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dprophet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dprophet/32/15354_2.png) [@dprophet](https://discuss.elastic.co/u/dprophet)\
**Post date:** [February 13, 2018, 4:42pm UTC](https://discuss.elastic.co/t/how-to-query-string-for-contains-this-also-contains-that-but-shouldnt-include-these-words/119677/1 "2018-02-13T16:42:50Z")

</div>

I have a string in elastic search. It looks like this

GET "/user/685934468/api/v1/tables/funds\_raised\_map\_by\_region\_1"

String is an HTTP RESTFul data endpoint with a breakdown like so  
GET /user/"numerical user ID"/api/v1/tables/"dataset name"

I need to query elastic via the Python API's with the logic like so

1. string must contain /user/
2. string must contain /api/v1/tables/
3. string must\_not contain this [] array of known dataset names.

Basically I am looking for strings that contain unknown dataset names.

The queries I have written dont return me the correct results. Its missing some.

FYI, I can query for all strings with /user/ and /api/v1/tables/ because the results are in the \>10,000. All strings are HTTP request strings from Logstash and Kibana. I am not sure if there is a string analyzer on those entries (not sure I know what I am talking about for string analyzer)

---

<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:** [March 13, 2018, 4:43pm UTC](https://discuss.elastic.co/t/how-to-query-string-for-contains-this-also-contains-that-but-shouldnt-include-these-words/119677/2 "2018-03-13T16:43:03Z")

</div>

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