elasticsearch


Multi prefix search with multi keys


A user wants to search a person by name and enter therefore something like:
"Pe Lu"
"Peter L"
"Lustig P"
All of these should match "Peter Lustig".
The data is indexed with default settings having firstname and lastname split.
I tried to use default prefix search using a bool "should" query having splitted the search term by whitespace.
bool
should
prefix
firstName Pe
prefix
name Pe
prefix
firstName Lu
prefix
name Lu
But I do not get any results for this. What is the best way to achieve this?
Can you try following query:;
{
"query": {
"bool": {
"should": [
{
"match_phrase_prefix": {
"firstName": "Peter"
}
},
{
"match_phrase_prefix": {
"firstName": "Lu"
}
},
{
"match_phrase_prefix": {
"lastName": "Peter"
}
},
{
"match_phrase_prefix": {
"lastName": "Lu"
}
}
]
}
}
}

Related Links

WHERE IN for Elastic search
how to do an atomic increment using elastic search update?
Insert data to ElasticSearch using NEST API
Elasticsearch aggregations, get additional field in bucket
Elasticsearch : match query with empty string as a value for field
How to use logstash's json filter?
Using minimum_should_match in filtered elasticSearch query
date not parsing correct in elasticsearch
Elasticsearch Filter by day of week
Cannot select time field for default index
elasticsearch nest index relational database
ElasticSearch - Phrase Suggestor
RCP with RabbitMQ connected to Logstash
Elasticsearch indexed search template generates empty strings in array
Can I use ElasticSearch mapping transform to duplicate a field
Drawing “opened count” over time given open-event and close-event documents

Categories

HOME
google-chrome
plesk
bokeh
ontology
facebook-android-sdk
repair
angular-meteor
javafx-8
gprs
native-base
tup
sharepoint-online
roku
clickable-image
spring-amqp
responsivevoice
live-streaming
cuba-platform
orange-api
bnf
pinterest
android-5.1.1-lollipop
fosuserbundle
significance
adobe-illustrator
substring
cellular-network
fatfs
basic-authentication
audit
xenapp
publishing
bootstrap-sass
bluemixtools
ftp-server
django-crispy-forms
fastlane
linq.js
assert
1wire
transparency
xcode8.2
kendo-editor
.when
ltrace
oid
tablespace
system.net.mail
android-4.2-jelly-bean
jtag
timestamping
distributed-cache
mercurial-extension
onepage-checkout
m4
gdl
textpattern
google-maps-api-2
directx-9
css-paged-media
.htpasswd
reference-counting
rails-api
fileshare
django-sites
facebook-game-groups
notifyjs
ui-design
jbox2d
smartfox
towers-of-hanoi
websphere-6.1
liveconnect
regression-testing
chunking
tabbarcontroller
fgetc
dm
powergui
accumulator
tso
html-generation

Resources

Encrypt Message