0
votes

I'm studying Elastic Search queries. I can not understand this query:

{
    "term" : { "user" : { "term" : "kimchy", "boost" : 2.0 } }
}

I've read this article but it's not clear: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-term-query.html

1- What is the second "term"?
2- What is the usage of boost?
3- How to use term or terms to have this query:
a field named "title" must contains: "key1" and "key2" or "key3" and "key4"

1

1 Answers

3
votes
  1. First term is the type of the query. Second term is the parameter of this query.

  2. boost is used to make this query more relevant than the default, in case you have several queries (the default boost value is 1.0)

  3. There are several ways to achieve this. One of them would be query_string, another a bool query. Here is an example of query_string:

{
    "query_string" : {
        "default_field" : "user",
        "query" : "(key1 AND key2) OR (key3 AND key4)"
    }
}