How to find whether the field in elasticSearch is sortable and analysed

How to find whether the field in elasticSearch is sortable and analysed

Welcome to our community! :smiley:

By default all fields are analysed. You will need to check the mappings for the index to see if it's explicitly set (or not) though.

You will also need to check the index settings to see if there are any sorts defined.

Thank you @warkolm

Keyword data type is not analysed by default if iam not wrong ,and not all the datatypes are sortable

It depends what you mean by sortable, it this?

You are right. But that's only if you have them defined as a keyword.

If we use the field capability API on a field which is of type keyword the response is something like this

"Email" : {
"keyword" : {
"type" : "keyword",
"searchable" : true,
"aggregatable" : true
}
}
This response indicates that it's searchable ,does this mean it's analysed?(keyword datatype is not analysed,but here it is true for searchable)
2nd question would be does aggregatable:true mean it's sortable?

You need to check the mappings.

@warkolm

This is the mapping :
PUT my-index-000003
{
"mappings": {
"properties": {
"tags": {
"type": "keyword"
}
}
}
}

Response of field capability API:

GET /my-index-000003/_field_caps?fields=tags
{
"indices" : [
"my-index-000003"
],
"fields" : {
"tags" : {
"keyword" : {
"type" : "keyword",
"searchable" : true,
"aggregatable" : true
}
}
}
}

Now does this indicate that "tags" field which is of type keyword is analysed and sortable?

Again, it depends what you mean by sortable. See my prior response and link.

The field is not analysed, no.

@warkolm thanks

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