# Can searchSource's query use not only query\_string

**URL:** <https://discuss.elastic.co/t/can-searchsources-query-use-not-only-query-string/83796>\
**Category:** Kibana\
**Created:** [April 27, 2017, 6:03am UTC](https://discuss.elastic.co/t/can-searchsources-query-use-not-only-query-string/83796 "2017-04-27T06:03:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![whoami](https://avatars.discourse-cdn.com/v4/letter/w/a9a28c/32.png) [@whoami](https://discuss.elastic.co/u/whoami)\
**Post date:** [April 27, 2017, 6:03am UTC](https://discuss.elastic.co/t/can-searchsources-query-use-not-only-query-string/83796/1 "2017-04-27T06:03:13Z")

</div>

in kibana 5.x, from the source code we can see:

```auto
    function addToBody() {
      state.body = state.body || {};
      // ignore if we already have a value
      if (state.body[key] == null) {
        if (key === 'query' && _.isString(val)) {
          val = { query_string: { query: val }};
        }

        state.body[key] = val;
      }
    }

```

if we use searchSource.set('query', '#value#'), #value# will be used for query\_string, if we wanna write some complex condition by dsl, how?

---

<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:** [May 25, 2017, 6:17am UTC](https://discuss.elastic.co/t/can-searchsources-query-use-not-only-query-string/83796/2 "2017-05-25T06:17:49Z")

</div>

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