Elasticsearch “AND in query_string” vs. “default_operator AND”

elasticsearch v7.1.1

I dont understand the difference between a query_string containing "AND" vs. "default_operator AND"

I thought it should yield the same result, but doesnt:

Data:

HTTP POST http://localhost:9200/_bulk

{ "index" : { "_index" : "umlautsuche", "_id" : "1" } }
{"vorname": "Stephan-Jörg", "nachname": "Müller", "ort": "Hollabrunn"}

{ "index" : { "_index" : "umlautsuche", "_id" : "2" } }
{"vorname": "Stephan-Joerg", "nachname": "Mueller", "ort": "Hollabrunn"}

{ "index" : { "_index" : "umlautsuche", "_id" : "3" } }
{"vorname": "Stephan-Jörg", "nachname": "Müll", "ort": "Hollabrunn"}

No results here - unexpected by me:

HTTP POST http://localhost:9200/umlautsuche/_search

{
  "query": {
		"query_string": {
			"query": "Stefan Müller Jör*",
			"analyze_wildcard": true,
			"default_operator": "AND",
			"fields": ["vorname", "nachname"]
		}
	}
}

This query gives the results as expected by me:

HTTP POST http://localhost:9200/umlautsuche/_search

{
  "query": {
		"query_string": {
			"query": "Stefan AND Müller AND Jör*",
			"analyze_wildcard": true,
			"default_operator": "AND",
			"fields": ["vorname", "nachname"]
		}
	}
}

Index mapping:

HTTP POST http://localhost:9200/umlautsuche

{
  "settings": {
	"analysis": {
	  "char_filter": {
		"my_char_filter": {
		  "type": "mapping",
		  "mappings": ["ph => f"]
		}
	  },
	  "filter": {
		"my_ngram": {
			"type": "edge_ngram",
			"min_gram": 3,
			"max_gram": 10
		}
	  },
	  "analyzer": {
		"my_name_analyzer": {
		  "tokenizer":  "standard",
		  "char_filter": [
			"my_char_filter"
		  ],
		  "filter": [
			"lowercase",
			"german_normalization"
		  ]
		}
	  }
	}
  },
  "mappings": {
	"date_detection": false,
	"dynamic_templates": [
	  {
		"string_fields_german": {
		  "match_mapping_type": "string",
		  "match": "*",
		  "mapping": {
			"type": "text",
			"analyzer": "my_name_analyzer"
		  }
		}
	  },
	  {
		"dates": {
		  "match": "lastModified",
		  "match_pattern": "regex",
		  "mapping": {
			"type": "date",
			"ignore_malformed": true
		  }
		}
	  }
	]
  }
}

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