0

Long story short.

I need to create an analogue with elasticjs for query:

http://example.com/one/two/_search?q=tags:three*

I'm confused with options listed on the docs page. Already tried to create BoolQuery, TermQuery and a couple of others, but they don't work for me.

I'm stuck now and would appreciate any kind of help on subject.

P.S. And another side of the same question. I can't find how json should look to obtain the same data. Came up with this solution so far, but unfortunately it's not working:

{
  "query": {
    "bool": {
      "should": [
        {
          "term": {
            "tag": "three*"
          }
        }
      ]
    }
  }
}
Dmitry Evseev
  • 11,533
  • 3
  • 34
  • 48

1 Answers1

1
ejs.Request()
    .indices("one") 
    .types("two")
    .query(ejs.QueryStringQuery ( "tags:three*" ))
    .doSearch(function (data) {
        // do something with data
    });

P.S. In json:

{
  "query": {
    "query_string": {
      "query": "tags:three*"
    }
  }
}

or

{
  "query": {
    "wildcard": {
      "tags": "three*" 
    }
  }
}
Dmitry Evseev
  • 11,533
  • 3
  • 34
  • 48
imotov
  • 28,277
  • 3
  • 90
  • 82