スパン用語クエリ

用語を含むスパンに一致します。以下はその例です:

Python

  1. resp = client.search(
  2. query={
  3. "span_term": {
  4. "user.id": "kimchy"
  5. }
  6. },
  7. )
  8. print(resp)

Ruby

  1. response = client.search(
  2. body: {
  3. query: {
  4. span_term: {
  5. 'user.id' => 'kimchy'
  6. }
  7. }
  8. }
  9. )
  10. puts response

Js

  1. const response = await client.search({
  2. query: {
  3. span_term: {
  4. "user.id": "kimchy",
  5. },
  6. },
  7. });
  8. console.log(response);

コンソール

  1. GET /_search
  2. {
  3. "query": {
  4. "span_term" : { "user.id" : "kimchy" }
  5. }
  6. }

クエリに関連付けられるブーストもあります:

Python

  1. resp = client.search(
  2. query={
  3. "span_term": {
  4. "user.id": {
  5. "value": "kimchy",
  6. "boost": 2
  7. }
  8. }
  9. },
  10. )
  11. print(resp)

Ruby

  1. response = client.search(
  2. body: {
  3. query: {
  4. span_term: {
  5. 'user.id' => {
  6. value: 'kimchy',
  7. boost: 2
  8. }
  9. }
  10. }
  11. }
  12. )
  13. puts response

Js

  1. const response = await client.search({
  2. query: {
  3. span_term: {
  4. "user.id": {
  5. value: "kimchy",
  6. boost: 2,
  7. },
  8. },
  9. },
  10. });
  11. console.log(response);

コンソール

  1. GET /_search
  2. {
  3. "query": {
  4. "span_term" : { "user.id" : { "value" : "kimchy", "boost" : 2.0 } }
  5. }
  6. }

または:

Python

  1. resp = client.search(
  2. query={
  3. "span_term": {
  4. "user.id": {
  5. "term": "kimchy",
  6. "boost": 2
  7. }
  8. }
  9. },
  10. )
  11. print(resp)

Ruby

  1. response = client.search(
  2. body: {
  3. query: {
  4. span_term: {
  5. 'user.id' => {
  6. term: 'kimchy',
  7. boost: 2
  8. }
  9. }
  10. }
  11. }
  12. )
  13. puts response

Js

  1. const response = await client.search({
  2. query: {
  3. span_term: {
  4. "user.id": {
  5. term: "kimchy",
  6. boost: 2,
  7. },
  8. },
  9. },
  10. });
  11. console.log(response);

コンソール

  1. GET /_search
  2. {
  3. "query": {
  4. "span_term" : { "user.id" : { "term" : "kimchy", "boost" : 2.0 } }
  5. }
  6. }