提取文档
POST test_david_zhao/_doc
{
"text": "tasty apple is good"
}
POST test_david_zhao/_doc
{
"text": "tasty grape is good"
}
POST test_david_zhao/_doc
{
"text": "tasty banana is good"
}
POST test_david_zhao/_doc
{
"text": "nasty banana is bad"
}
POST test_david_zhao/_doc
{
"text": "dirty grape is bad"
}
查询
POST test_david_zhao/_search
{
"query": {
"query_string": {
"default_field": "text",
"query": "+(text:apple text:banana text: grape) +(text:tasty text:nasty)"
}
}
}
回应
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 4,
"relation" : "eq"
},
"max_score" : 2.261763,
"hits" : [
{
"_index" : "test_david_zhao",
"_type" : "_doc",
"_id" : "d6t3_HcBDMyXCx985YKJ",
"_score" : 2.261763,
"_source" : {
"text" : "nasty banana is bad"
}
},
{
"_index" : "test_david_zhao",
"_type" : "_doc",
"_id" : "dKt3_HcBDMyXCx9804Le",
"_score" : 1.9252907,
"_source" : {
"text" : "tasty apple is good"
}
},
{
"_index" : "test_david_zhao",
"_type" : "_doc",
"_id" : "dat3_HcBDMyXCx982oIq",
"_score" : 1.4144652,
"_source" : {
"text" : "tasty grape is good"
}
},
{
"_index" : "test_david_zhao",
"_type" : "_doc",
"_id" : "dqt3_HcBDMyXCx984IJD",
"_score" : 1.4144652,
"_source" : {
"text" : "tasty banana is good"
}
}
]
}
}