Analyzer is not being applied to fields?
See original GitHub issuecontracts = Index('contracts')
my_analyzer = analyzer('simple')
contracts.analyzer(my_analyzer)
@contracts.doc_type
class ContractDocument(DocType):
client = fields.StringField(attr='client_name')
class Meta:
model = Contract
fields = [
'id',
'name'
]
I am trying to apply simple
analyzer on fields. But when I call termvectors
after running search_index
, I see that standard
analyzer is applied on fields.
How can I apply simple
analyzer to all fields?
I have tons of fields, I don’t want to declare them by hand. Only solution is to create an ES Field for each model field? How can I declare analyzer for fields in Meta.fields
or how can I modify my class to do this?
You can discard the Django related parts.
I guess this kind of analyzer settings does not do this:
PUT /contracts
{
"mappings": {
"contract_document":{
"properties": {
"name":{
"type":"text",
"analyzer": "simple"
}
}
}
}
}
Right?
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Updating Documents in Elasticsearch is not Applying the ...
When creating documents normally with data in Field the analyzer is working correctly. Field has the data in lowercase and Field.raw has the ......
Read more >Hash tag field analyzer not being applied - Elasticsearch
Hello! I have configured an analyzer in my YML to exclude all words that do not start with either # or @ to...
Read more >Running Your Analyzer | Apache Solr Reference Guide 6.6
Once you've defined a field type in your Schema, and specified the analysis steps that you want applied to it, you should test...
Read more >Analyzer and search_analyzer on field
A detailed guide on how to resolve errors related to "analyzer and search_analyzer on field"
Read more >Add language analyzers to string fields - Azure
How to specify a language analyzer · In the field definition, make sure the field is attributed as "searchable" and is of type...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You can define an analyzer for a field by passing it as a parameter to the field class:
name = Text(analyzer='simple')
unfortunately I am not familiar with the API that you are using, but just passing a name of a built-in analyzer or an
Analyzer
instance should work.If you don’t create the index explicitly an empty index with default mappings (== using
standard
analyzer) will be created for you. That is why you have to create the index explicitly before pushing any documents in. See (0) for more details.0 - http://elasticsearch-dsl.readthedocs.io/en/latest/persistence.html#document-life-cycle