Begriff und Begriffe Abfragen (Finden Sie diese Informationen , die Person zhaoliu)
Begriff Frage an den invertierten Index Bogen gehen | den genauen Begriff zu finden, die es nicht wissen , die Existenz des Wortes. Eine solche Abfrage für Schlüsselwort, numerisch DATE ..
Term: Abfrage ein Feld enthält eine Keyword - Dokumentation
GET / lib3 / user / _search / { "Abfrage": { "Ausdruck": {Interessen ":" Changge „} }}
Ausdrücke: ein Abfragefeld mit einer Vielzahl von Schlüsselwort gebundenen Dokument
GET / ib3 / user / _search { "Abfrage": { "Begriffe ': {" Interesse ": [" hejiu "" Changge']}}
GET /lib3/user/_search
{
"query": {
"term": {
"name": {
"value": "zhaoliu"
}
}
}
}
GET /lib3/user/_search
{
"query": {
"term": {
"name": "zhaoliu"
}
}
}
{
"took" : 5,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 0.2876821,
"hits" : [
{
"_index" : "lib3",
"_type" : "user",
"_id" : "1",
"_score" : 0.2876821,
"_source" : {
"name" : "zhaoliu",
"address" : "hei long jiang sheng tie ling shi",
"age" : 50,
"birthday" : "1970-12-12",
"interests" : "xi buan hejiu, duanlian, lvyou"
}
}
]
}
}
Finden Hobbys Interessen der Menschen als hejiu Changge Informationen
GET /lib3/user/_search
{
"query": {
"terms": {
"interests": ["hejiu","changge"]
}
}
}
{
"took" : 56,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : 4,
"max_score" : 1.0,
"hits" : [
{
"_index" : "lib3",
"_type" : "user",
"_id" : "5",
"_score" : 1.0,
"_source" : {
"name" : "zhangsan",
"address" : "bei jing chao yang qu",
"age" : 29,
"birthday" : "1988-10-12",
"interests" : "xi huan tingyinyue , changge , tiaowu"
}
},
{
"_index" : "lib3",
"_type" : "user",
"_id" : "2",
"_score" : 1.0,
"_source" : {
"name" : "zhaoming",
"address" : "bei jing hai dian qu qing he zhen",
"age" : 20,
"birthday" : "1998-10-12",
"interests" : "xi huan hejiu, duanlian, changge"
}
},
{
"_index" : "lib3",
"_type" : "user",
"_id" : "1",
"_score" : 1.0,
"_source" : {
"name" : "zhaoliu",
"address" : "hei long jiang sheng tie ling shi",
"age" : 50,
"birthday" : "1970-12-12",
"interests" : "xi buan hejiu, duanlian, lvyou"
}
},
{
"_index" : "lib3",
"_type" : "user",
"_id" : "3",
"_score" : 1.0,
"_source" : {
"name" : "lisi",
"address" : "bei jing hai dian qu qing he zhen",
"age" : 23,
"birthday" : "1998-10-12",
"interests" : "xi huan hejiu,duanlian, changge"
}
}
]
}
}
Solange es ein Schlüsselwort Abfrage wird aus insgesamt vier Personen enthält haben über hejiu entweder Changge eine oder beide hejiu Changge
Wenn ich will, nur aus dem ersten beide persönlichen Gebrauch nehmen: 0 (beginnt mit dem ersten Dokument) Größe: 2 (Take 2 Dokumente)
GET /lib3/user/_search
{
"from":0,
"size":2,
"query": {
"terms": {
"interests": ["hejiu","changge"]
}
}
}
{
"took" : 81,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : 4,
"max_score" : 1.0,
"hits" : [
{
"_index" : "lib3",
"_type" : "user",
"_id" : "5",
"_score" : 1.0,
"_source" : {
"name" : "zhangsan",
"address" : "bei jing chao yang qu",
"age" : 29,
"birthday" : "1988-10-12",
"interests" : "xi huan tingyinyue , changge , tiaowu"
}
},
{
"_index" : "lib3",
"_type" : "user",
"_id" : "2",
"_score" : 1.0,
"_source" : {
"name" : "zhaoming",
"address" : "bei jing hai dian qu qing he zhen",
"age" : 20,
"birthday" : "1998-10-12",
"interests" : "xi huan hejiu, duanlian, changge"
}
}
]
}
}
Die obige Abfrage ist keine Versionsnummer wir die Versionsnummer erhalten möchten, fügen Sie einfach eine Version: true
GET /lib3/user/_search
{
"version": true,
"query": {
"terms": {
"interests": ["hejiu","changge"]
}
}
}
{
"took" : 33,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : 4,
"max_score" : 1.0,
"hits" : [
{
"_index" : "lib3",
"_type" : "user",
"_id" : "5",
"_version" : 1,
"_score" : 1.0,
"_source" : {
"name" : "zhangsan",
"address" : "bei jing chao yang qu",
"age" : 29,
"birthday" : "1988-10-12",
"interests" : "xi huan tingyinyue , changge , tiaowu"
}
},
{
"_index" : "lib3",
"_type" : "user",
"_id" : "2",
"_version" : 1,
"_score" : 1.0,
"_source" : {
"name" : "zhaoming",
"address" : "bei jing hai dian qu qing he zhen",
"age" : 20,
"birthday" : "1998-10-12",
"interests" : "xi huan hejiu, duanlian, changge"
}
},
{
"_index" : "lib3",
"_type" : "user",
"_id" : "1",
"_version" : 1,
"_score" : 1.0,
"_source" : {
"name" : "zhaoliu",
"address" : "hei long jiang sheng tie ling shi",
"age" : 50,
"birthday" : "1970-12-12",
"interests" : "xi buan hejiu, duanlian, lvyou"
}
},
{
"_index" : "lib3",
"_type" : "user",
"_id" : "3",
"_version" : 1,
"_score" : 1.0,
"_source" : {
"name" : "lisi",
"address" : "bei jing hai dian qu qing he zhen",
"age" : 23,
"birthday" : "1998-10-12",
"interests" : "xi huan hejiu,duanlian, changge"
}
}
]
}
}