Spec-Zone.ru › Elasticsearch 8
›Elasticsearch Guide [8.17] ›Query DSL ›Span запросы

Запрос span term

Совпадение с разделами, содержащими термин. Вот пример:

resp = client.search(
    query={
        "span_term": {
            "user.id": "kimchy"
        }
    },
)
print(resp)
response = client.search(
  body: {
    query: {
      span_term: {
        'user.id' => 'kimchy'
      }
    }
  }
)
puts response
const response = await client.search({
  query: {
    span_term: {
      "user.id": "kimchy",
    },
  },
});
console.log(response);
GET /_search
{
  "query": {
    "span_term" : { "user.id" : "kimchy" }
  }
}

Усилитель также может быть связан с запросом:

resp = client.search(
    query={
        "span_term": {
            "user.id": {
                "value": "kimchy",
                "boost": 2
            }
        }
    },
)
print(resp)
response = client.search(
  body: {
    query: {
      span_term: {
        'user.id' => {
          value: 'kimchy',
          boost: 2
        }
      }
    }
  }
)
puts response
const response = await client.search({
  query: {
    span_term: {
      "user.id": {
        value: "kimchy",
        boost: 2,
      },
    },
  },
});
console.log(response);
GET /_search
{
  "query": {
    "span_term" : { "user.id" : { "value" : "kimchy", "boost" : 2.0 } }
  }
}

Или:

resp = client.search(
    query={
        "span_term": {
            "user.id": {
                "term": "kimchy",
                "boost": 2
            }
        }
    },
)
print(resp)
response = client.search(
  body: {
    query: {
      span_term: {
        'user.id' => {
          term: 'kimchy',
          boost: 2
        }
      }
    }
  }
)
puts response
const response = await client.search({
  query: {
    span_term: {
      "user.id": {
        term: "kimchy",
        boost: 2,
      },
    },
  },
});
console.log(response);
GET /_search
{
  "query": {
    "span_term" : { "user.id" : { "term" : "kimchy", "boost" : 2.0 } }
  }
}

© 2023-2025 Elasticsearch
As of September 2024, Elasticsearch is available under a choice of three licenses: the Server Side Public License (SSPL), the Elastic License, or the AGPLv3 (OSI approved).
Elasticsearch and the Elasticsearch logo are trademarks of Elasticsearch B.V., registered in the U.S. and in other countries.
https://www.elastic.co/guide/en/elasticsearch/reference/8.17/query-dsl-span-term-query.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API