Default_operator not working

Hi, I try run:

oracle AND san AND francisco AND hadoop

Get total of 1118 matches.

Then I try:

oracle san francisco hadoop

I get total of 59 matches.

Query looks like:

[
'query' => [
'function_score' => [
'query' => [
"bool" => [
"must" => [
'query_string' => [
'query' => $query, 'default_operator' => 'AND'
]
],
'filter' => [
'range' => [
'completeness' => [
'from'=>0.30, 'to'=> 1.0
]
]
]
]
],
'field_value_factor' => [
'field' => 'completeness'
]
]
],

Could you provide a full recreation script as described in About the Elasticsearch category. It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

A full reproduction script will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.

total result: 8077

{
"query": {
"query_string": {
"default_operator": "AND",
"query": "oracle AND san AND francisco AND hadoop"
}
}
}

total 331:

{
"query": {
"query_string": {
"default_operator": "AND",
"query": "oracle san francisco hadoop"
}
}
}

This works well on my end.

BTW here is what a reproduction script is:

DELETE test 
PUT test 
POST test/_doc
{
  "text": "oracle san francisco hadoop"
}
POST test/_doc
{
  "text": "oracle"
}
POST test/_doc
{
  "text": "san francisco"
}
POST test/_doc
{
  "text": "hadoop"
}
GET test/_search
{
  "query": {
    "query_string": {
      "query": "oracle AND san AND francisco AND hadoop"
    }
  }
}
GET test/_search
{
  "query": {
    "query_string": {
      "default_operator": "AND", 
      "query": "oracle san francisco hadoop"
    }
  }
}

Maybe it work only with 1 field. I have about 10 different search fields.

Maybe it work only with 1 field. I have about 10 different search fields.

How can I know?

If you need help, please do what I asked at

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.